'SK_SUPPORT_LEGACY_SETCONFIG_INFO',
'SK_SUPPORT_LEGACY_SETCONFIG',
'SK_SUPPORT_LEGACY_IMAGEDECODER_CONFIG',
+ 'SK_SUPPORT_LEGACY_DEVICE_VIRTUAL_ISOPAQUE',
# Needed until we fix skbug.com/2440.
'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
# Transitional, for deprecated SkCanvas::SaveFlags methods.
#
'skia_for_chromium_defines': [
'SK_SUPPORT_LEGACY_GETTOPDEVICE',
+ 'SK_SUPPORT_LEGACY_DEVICE_VIRTUAL_ISOPAQUE',
'SK_SUPPORT_LEGACY_N32_NAME',
'SK_SUPPORT_LEGACY_SETCONFIG',
'SK_IGNORE_ETC1_SUPPORT',
static SkBitmapDevice* Create(const SkImageInfo&,
const SkDeviceProperties* = NULL);
- /** Return the width of the device (in pixels).
- */
- virtual int width() const SK_OVERRIDE { return fBitmap.width(); }
- /** Return the height of the device (in pixels).
- */
- virtual int height() const SK_OVERRIDE { return fBitmap.height(); }
-
- /** Returns true if the device's bitmap's config treats every pixels as
- implicitly opaque.
- */
- virtual bool isOpaque() const SK_OVERRIDE { return fBitmap.isOpaque(); }
-
virtual SkImageInfo imageInfo() const SK_OVERRIDE;
/**
SkMetaData& getMetaData();
- /** Return the width of the device (in pixels).
- */
- virtual int width() const = 0;
- /** Return the height of the device (in pixels).
- */
- virtual int height() const = 0;
-
/** Return the image properties of the device. */
virtual const SkDeviceProperties& getDeviceProperties() const {
//Currently, all the properties are leaky.
bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height());
}
- /** Returns true if the device's bitmap's config treats every pixel as
- implicitly opaque.
- */
- virtual bool isOpaque() const = 0;
+#ifdef SK_SUPPORT_LEGACY_DEVICE_VIRTUAL_ISOPAQUE
+ virtual int width() const {
+ return this->imageInfo().width();
+ }
+ virtual int height() const {
+ return this->imageInfo().height();
+ }
+ virtual bool isOpaque() const {
+ return this->imageInfo().isOpaque();
+ }
+#else
+ int width() const {
+ return this->imageInfo().width();
+ }
+ int height() const {
+ return this->imageInfo().height();
+ }
+ bool isOpaque() const {
+ return this->imageInfo().isOpaque();
+ }
+#endif
/** Return the bitmap associated with this device. Call this each time you need
to access the bitmap, as it notifies the subclass to perform any flushing
return info;
}
+ static SkImageInfo MakeUnknown() {
+ SkImageInfo info = {
+ 0, 0, kUnknown_SkColorType, kIgnore_SkAlphaType
+ };
+ return info;
+ }
+
int width() const { return fWidth; }
int height() const { return fHeight; }
SkColorType colorType() const { return fColorType; }
virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE;
- // overrides from SkBaseDevice
- virtual int width() const SK_OVERRIDE {
- return NULL == fRenderTarget ? 0 : fRenderTarget->width();
- }
- virtual int height() const SK_OVERRIDE {
- return NULL == fRenderTarget ? 0 : fRenderTarget->height();
- }
- virtual bool isOpaque() const SK_OVERRIDE {
- return NULL == fRenderTarget ? false
- : kRGB_565_GrPixelConfig == fRenderTarget->config();
+ virtual SkImageInfo imageInfo() const SK_OVERRIDE {
+ return fRenderTarget ? fRenderTarget->info() : SkImageInfo::MakeUnknown();
}
virtual void clear(SkColor color) SK_OVERRIDE;
return *fMetaData;
}
-// TODO: should make this guy pure-virtual.
SkImageInfo SkBaseDevice::imageInfo() const {
- return SkImageInfo::MakeUnknown(this->width(), this->height());
+ return SkImageInfo::MakeUnknown();
}
const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) {
virtual ~GrGatherDevice() { }
- virtual int width() const SK_OVERRIDE { return fInfo.fSize.width(); }
- virtual int height() const SK_OVERRIDE { return fInfo.fSize.height(); }
- virtual bool isOpaque() const SK_OVERRIDE { return false; }
virtual SkImageInfo imageInfo() const SK_OVERRIDE {
return fEmptyBitmap.info();
}
void setMaxRecordingStorage(size_t);
void recordedDrawCommand();
- virtual int width() const SK_OVERRIDE;
- virtual int height() const SK_OVERRIDE;
- virtual bool isOpaque() const SK_OVERRIDE;
virtual SkImageInfo imageInfo() const SK_OVERRIDE;
virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE;
return fSurface ? fSurface->newImageSnapshot() : NULL;
}
-int SkDeferredDevice::width() const {
- return immediateDevice()->width();
-}
-
-int SkDeferredDevice::height() const {
- return immediateDevice()->height();
-}
-
-bool SkDeferredDevice::isOpaque() const {
- return immediateDevice()->isOpaque();
-}
-
SkImageInfo SkDeferredDevice::imageInfo() const {
return immediateDevice()->imageInfo();
}
SkSafeUnref(fPRCont);
}
- virtual int width() const SK_OVERRIDE { return fSize.width(); }
- virtual int height() const SK_OVERRIDE { return fSize.height(); }
- virtual bool isOpaque() const SK_OVERRIDE { return false; }
virtual SkImageInfo imageInfo() const SK_OVERRIDE {
return fEmptyBitmap.info();
}
fPRSet = prset;
}
- virtual int width() const SK_OVERRIDE { return fSize.width(); }
- virtual int height() const SK_OVERRIDE { return fSize.height(); }
- virtual bool isOpaque() const SK_OVERRIDE { return false; }
+ virtual SkImageInfo imageInfo() const SK_OVERRIDE {
+ return SkImageInfo::MakeUnknown(fSize.width(), fSize.height());
+ }
virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE { return NULL; }
virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE {
return false;