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

Side by Side Diff: include/core/SkDevice.h

Issue 719253002: rename filterTextFlags to disableLCD (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2010 The Android Open Source Project 2 * Copyright 2010 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkDevice_DEFINED 8 #ifndef SkDevice_DEFINED
9 #define SkDevice_DEFINED 9 #define SkDevice_DEFINED
10 10
(...skipping 15 matching lines...) Expand all
26 class SK_API SkBaseDevice : public SkRefCnt { 26 class SK_API SkBaseDevice : public SkRefCnt {
27 public: 27 public:
28 SK_DECLARE_INST_COUNT(SkBaseDevice) 28 SK_DECLARE_INST_COUNT(SkBaseDevice)
29 29
30 /** 30 /**
31 * Construct a new device. 31 * Construct a new device.
32 */ 32 */
33 SkBaseDevice(); 33 SkBaseDevice();
34 virtual ~SkBaseDevice(); 34 virtual ~SkBaseDevice();
35 35
36 SkBaseDevice* createCompatibleDevice(const SkImageInfo&); 36 // SkBaseDevice* createCompatibleDevice(const SkImageInfo&);
37 37
38 SkMetaData& getMetaData(); 38 SkMetaData& getMetaData();
39 39
40 /** 40 /**
41 * Return ImageInfo for this device. If the canvas is not backed by pixels 41 * Return ImageInfo for this device. If the canvas is not backed by pixels
42 * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType. 42 * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType.
43 */ 43 */
44 virtual SkImageInfo imageInfo() const; 44 virtual SkImageInfo imageInfo() const;
45 45
46 /** 46 /**
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 * possibly from SkCanvas' dtor. 111 * possibly from SkCanvas' dtor.
112 */ 112 */
113 virtual void onDetachFromCanvas() { 113 virtual void onDetachFromCanvas() {
114 SkASSERT(fAttachedToCanvas); 114 SkASSERT(fAttachedToCanvas);
115 this->unlockPixels(); 115 this->unlockPixels();
116 #ifdef SK_DEBUG 116 #ifdef SK_DEBUG
117 fAttachedToCanvas = false; 117 fAttachedToCanvas = false;
118 #endif 118 #endif
119 }; 119 };
120 120
121 bool disableLCD(const SkPaint&) const;
f(malita) 2014/11/12 20:49:14 This sounds imperative. Maybe canHandleLCD or supp
122
121 protected: 123 protected:
122 enum Usage { 124 enum Usage {
123 kGeneral_Usage, 125 kGeneral_Usage,
124 kSaveLayer_Usage, // <! internal use only 126 kSaveLayer_Usage, // <! internal use only
125 kImageFilter_Usage // <! internal use only 127 kImageFilter_Usage // <! internal use only
126 }; 128 };
127 129
128 struct TextFlags { 130 struct TextFlags {
129 uint32_t fFlags; // SkPaint::getFlags() 131 uint32_t fFlags; // SkPaint::getFlags()
130 }; 132 };
131 133
132 /** 134 virtual bool onDisableLCD(const SkPaint&) const { return false; }
133 * Device may filter the text flags for drawing text here. If it wants to
134 * make a change to the specified values, it should write them into the
135 * textflags parameter (output) and return true. If the paint is fine as
136 * is, then ignore the textflags parameter and return false.
137 */
138 virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) { return fals e; }
139 135
140 /** 136 /**
141 * 137 *
142 * DEPRECATED: This will be removed in a future change. Device subclasses 138 * DEPRECATED: This will be removed in a future change. Device subclasses
143 * should use the matrix and clip from the SkDraw passed to draw functions. 139 * should use the matrix and clip from the SkDraw passed to draw functions.
144 * 140 *
145 * Called with the correct matrix and clip before this device is drawn 141 * Called with the correct matrix and clip before this device is drawn
146 * to using those settings. If your subclass overrides this, be sure to 142 * to using those settings. If your subclass overrides this, be sure to
147 * call through to the base class as well. 143 * call through to the base class as well.
148 * 144 *
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // used to change the backend's pixels (and possibly config/rowbytes) 350 // used to change the backend's pixels (and possibly config/rowbytes)
355 // but cannot change the width/height, so there should be no change to 351 // but cannot change the width/height, so there should be no change to
356 // any clip information. 352 // any clip information.
357 // TODO: move to SkBitmapDevice 353 // TODO: move to SkBitmapDevice
358 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} 354 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {}
359 355
360 virtual bool forceConservativeRasterClip() const { return false; } 356 virtual bool forceConservativeRasterClip() const { return false; }
361 357
362 // just called by SkCanvas when built as a layer 358 // just called by SkCanvas when built as a layer
363 void setOrigin(int x, int y) { fOrigin.set(x, y); } 359 void setOrigin(int x, int y) { fOrigin.set(x, y); }
364 // just called by SkCanvas for saveLayer
365 SkBaseDevice* createCompatibleDeviceForSaveLayer(const SkImageInfo&);
366 // just called by SkCanvas for imagefilter
367 SkBaseDevice* createCompatibleDeviceForImageFilter(const SkImageInfo&);
368 360
369 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) { 361 void setup(SkPixelGeometry, Usage);
362
363 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage = kGeneral_Us age) {
370 return NULL; 364 return NULL;
371 } 365 }
372 366
373 /** Causes any deferred drawing to the device to be completed. 367 /** Causes any deferred drawing to the device to be completed.
374 */ 368 */
375 virtual void flush() {} 369 virtual void flush() {}
376 370
377 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } 371 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; }
378 372
379 SkIPoint fOrigin; 373 SkIPoint fOrigin;
380 SkMetaData* fMetaData; 374 SkMetaData* fMetaData;
381 SkDeviceProperties* fLeakyProperties; // will always exist. 375 SkDeviceProperties* fLeakyProperties; // will always exist.
382 376
383 #ifdef SK_DEBUG 377 #ifdef SK_DEBUG
384 bool fAttachedToCanvas; 378 bool fAttachedToCanvas;
385 #endif 379 #endif
386 380
387 typedef SkRefCnt INHERITED; 381 typedef SkRefCnt INHERITED;
388 }; 382 };
389 383
390 #endif 384 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698