Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: src/core/SkDevice.cpp

Issue 719253002: rename filterTextFlags to disableLCD (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rename disableLCD to shouldDisableLCD Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkDeviceImageFilterProxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDevice.cpp
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 20219a491aae33fd6aedfb6ed123c63107c0c643..90ea705adc65a72d02dc9e6d2101a66db4af1972 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -23,23 +23,21 @@ SkBaseDevice::SkBaseDevice()
fMetaData = NULL;
}
+SkBaseDevice::SkBaseDevice(const SkDeviceProperties& dp)
+ : fLeakyProperties(SkNEW_ARGS(SkDeviceProperties, (dp)))
+#ifdef SK_DEBUG
+ , fAttachedToCanvas(false)
+#endif
+{
+ fOrigin.setZero();
+ fMetaData = NULL;
+}
+
SkBaseDevice::~SkBaseDevice() {
SkDELETE(fLeakyProperties);
SkDELETE(fMetaData);
}
-SkBaseDevice* SkBaseDevice::createCompatibleDevice(const SkImageInfo& info) {
- return this->onCreateCompatibleDevice(CreateInfo(info, kGeneral_Usage));
-}
-
-SkBaseDevice* SkBaseDevice::createCompatibleDeviceForSaveLayer(const SkImageInfo& info) {
- return this->onCreateCompatibleDevice(CreateInfo(info, kSaveLayer_Usage));
-}
-
-SkBaseDevice* SkBaseDevice::createCompatibleDeviceForImageFilter(const SkImageInfo& info) {
- return this->onCreateCompatibleDevice(CreateInfo(info, kImageFilter_Usage));
-}
-
SkMetaData& SkBaseDevice::getMetaData() {
// metadata users are rare, so we lazily allocate it. If that changes we
// can decide to just make it a field in the device (rather than a ptr)
@@ -61,8 +59,31 @@ const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) {
return bitmap;
}
-void SkBaseDevice::setPixelGeometry(SkPixelGeometry geo) {
- fLeakyProperties->setPixelGeometry(geo);
+SkPixelGeometry SkBaseDevice::CreateInfo::AdjustGeometry(const SkImageInfo& info,
+ Usage usage,
+ SkPixelGeometry geo) {
+ switch (usage) {
+ case kGeneral_Usage:
+ break;
+ case kSaveLayer_Usage:
+ if (info.alphaType() != kOpaque_SkAlphaType) {
+ geo = kUnknown_SkPixelGeometry;
+ }
+ break;
+ case kImageFilter_Usage:
+ geo = kUnknown_SkPixelGeometry;
+ break;
+ }
+ return geo;
+}
+
+void SkBaseDevice::initForRootLayer(SkPixelGeometry geo) {
+ // For now we don't expect to change the geometry for the root-layer, but we make the call
+ // anyway to document logically what is going on.
+ //
+ fLeakyProperties->setPixelGeometry(CreateInfo::AdjustGeometry(this->imageInfo(),
+ kGeneral_Usage,
+ geo));
}
SkSurface* SkBaseDevice::newSurface(const SkImageInfo&, const SkSurfaceProps&) { return NULL; }
@@ -187,3 +208,18 @@ bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S
// The base class doesn't perform any accelerated picture rendering
return false;
}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
+bool SkBaseDevice::shouldDisableLCD(const SkPaint& paint) const {
+ if (!paint.isLCDRenderText() || !paint.isAntiAlias()) {
+ return false;
+ }
+
+ if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry()) {
+ return true;
+ }
+
+ return this->onShouldDisableLCD(paint);
+}
+
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkDeviceImageFilterProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698