зеркало из https://github.com/electron/electron.git
Remove the NativeImage::MakeTemplateImage method
Is duplicate with SetTemplateImage.
This commit is contained in:
Родитель
f11988a354
Коммит
91c9f590dd
|
@ -138,9 +138,7 @@ mate::ObjectTemplateBuilder NativeImage::GetObjectTemplateBuilder(
|
|||
.SetMethod("toDataUrl", &NativeImage::ToDataURL)
|
||||
.SetMethod("isEmpty", &NativeImage::IsEmpty)
|
||||
.SetMethod("getSize", &NativeImage::GetSize)
|
||||
#if defined(OS_MACOSX)
|
||||
.SetMethod("setTemplateImage", &NativeImage::SetTemplateImage)
|
||||
#endif
|
||||
.Build());
|
||||
|
||||
return mate::ObjectTemplateBuilder(
|
||||
|
@ -179,6 +177,11 @@ gfx::Size NativeImage::GetSize() {
|
|||
return image_.Size();
|
||||
}
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
void NativeImage::SetTemplateImage(bool setAsTemplate) {
|
||||
}
|
||||
#endif
|
||||
|
||||
// static
|
||||
mate::Handle<NativeImage> NativeImage::CreateEmpty(v8::Isolate* isolate) {
|
||||
return mate::CreateHandle(isolate, new NativeImage);
|
||||
|
@ -212,11 +215,12 @@ mate::Handle<NativeImage> NativeImage::CreateFromPath(
|
|||
gfx::ImageSkia image_skia;
|
||||
PopulateImageSkiaRepsFromPath(&image_skia, path);
|
||||
gfx::Image image(image_skia);
|
||||
mate::Handle<NativeImage> handle = Create(isolate, image);
|
||||
#if defined(OS_MACOSX)
|
||||
if (IsTemplateImage(path))
|
||||
MakeTemplateImage(&image);
|
||||
handle->SetTemplateImage(true);
|
||||
#endif
|
||||
return Create(isolate, image);
|
||||
return handle;
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
@ -59,18 +59,15 @@ class NativeImage : public mate::Wrappable {
|
|||
v8::Isolate* isolate) override;
|
||||
|
||||
private:
|
||||
#if defined(OS_MACOSX)
|
||||
// Mark the image as template image if possible.
|
||||
static void MakeTemplateImage(gfx::Image* image);
|
||||
void SetTemplateImage(bool setAsTemplate);
|
||||
#endif
|
||||
|
||||
v8::Handle<v8::Value> ToPNG(v8::Isolate* isolate);
|
||||
v8::Handle<v8::Value> ToJPEG(v8::Isolate* isolate, int quality);
|
||||
std::string ToDataURL();
|
||||
bool IsEmpty();
|
||||
gfx::Size GetSize();
|
||||
|
||||
// Mark the image as template image.
|
||||
void SetTemplateImage(bool setAsTemplate);
|
||||
|
||||
gfx::Image image_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NativeImage);
|
||||
|
|
|
@ -10,11 +10,6 @@ namespace atom {
|
|||
|
||||
namespace api {
|
||||
|
||||
// static
|
||||
void NativeImage::MakeTemplateImage(gfx::Image* image) {
|
||||
[image->AsNSImage() setTemplate:YES];
|
||||
}
|
||||
|
||||
void NativeImage::SetTemplateImage(bool setAsTemplate) {
|
||||
[image_.AsNSImage() setTemplate:setAsTemplate];
|
||||
}
|
||||
|
|
|
@ -136,4 +136,4 @@ Returns the size of the image.
|
|||
|
||||
* `option` Boolean
|
||||
|
||||
To toggle a `NativeImage` as Template image on OSX
|
||||
Marks the image as template image.
|
||||
|
|
Загрузка…
Ссылка в новой задаче