aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-15 20:56:58 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-15 20:56:58 +0000
commitf67e4cf4c18cd228738a11372859ee0280bce1d7 (patch)
treea456d4c82362669303d993c57e326a1fd0466e59 /src/gpu
parent759c16e20dc42577226c8805bfea92d8bacb14d8 (diff)
add filterTextFlags() to SkDevice (virtual) to allow device subclasses to
filter what text features we try to use. The filtering allows for implementation limitations to dictate when we turn off certain text features. git-svn-id: http://skia.googlecode.com/svn/trunk@943 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/SkGpuDevice.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 91a6319a17..3707b67119 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1181,6 +1181,31 @@ void SkGpuDevice::drawTextOnPath(const SkDraw& draw, const void* text,
///////////////////////////////////////////////////////////////////////////////
+bool SkGpuDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) {
+ if (!paint.isLCDRenderText()) {
+ // we're cool with the paint as is
+ return false;
+ }
+
+ if (paint.getShader() ||
+ paint.getXfermode() || // unless its srcover
+ paint.getMaskFilter() ||
+ paint.getRasterizer() ||
+ paint.getColorFilter() ||
+ paint.getPathEffect() ||
+ paint.isFakeBoldText() ||
+ paint.getStyle() != SkPaint::kFill_Style) {
+ // turn off lcd
+ flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag;
+ flags->fHinting = paint.getHinting();
+ return true;
+ }
+ // we're cool with the paint as is
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
SkGpuDevice::TexCache* SkGpuDevice::lockCachedTexture(const SkBitmap& bitmap,
const GrSamplerState& sampler,
GrTexture** texture,