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

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: 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 unified diff | Download patch
« no previous file with comments | « include/core/SkCanvas.h ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 13 matching lines...) Expand all
24 class GrRenderTarget; 24 class GrRenderTarget;
25 25
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 explicit SkBaseDevice(const SkDeviceProperties&);
34 virtual ~SkBaseDevice(); 35 virtual ~SkBaseDevice();
35 36
36 SkBaseDevice* createCompatibleDevice(const SkImageInfo&);
37
38 SkMetaData& getMetaData(); 37 SkMetaData& getMetaData();
39 38
40 /** 39 /**
41 * Return ImageInfo for this device. If the canvas is not backed by pixels 40 * 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. 41 * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType.
43 */ 42 */
44 virtual SkImageInfo imageInfo() const; 43 virtual SkImageInfo imageInfo() const;
45 44
46 /** 45 /**
47 * Return the bounds of the device in the coordinate space of the root 46 * Return the bounds of the device in the coordinate space of the root
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 * possibly from SkCanvas' dtor. 110 * possibly from SkCanvas' dtor.
112 */ 111 */
113 virtual void onDetachFromCanvas() { 112 virtual void onDetachFromCanvas() {
114 SkASSERT(fAttachedToCanvas); 113 SkASSERT(fAttachedToCanvas);
115 this->unlockPixels(); 114 this->unlockPixels();
116 #ifdef SK_DEBUG 115 #ifdef SK_DEBUG
117 fAttachedToCanvas = false; 116 fAttachedToCanvas = false;
118 #endif 117 #endif
119 }; 118 };
120 119
120 bool shouldDisableLCD(const SkPaint&) const;
121
121 protected: 122 protected:
122 enum Usage { 123 enum Usage {
123 kGeneral_Usage, 124 kGeneral_Usage,
124 kSaveLayer_Usage, // <! internal use only 125 kSaveLayer_Usage, // <! internal use only
125 kImageFilter_Usage // <! internal use only 126 kImageFilter_Usage // <! internal use only
126 }; 127 };
127 128
128 struct TextFlags { 129 struct TextFlags {
129 uint32_t fFlags; // SkPaint::getFlags() 130 uint32_t fFlags; // SkPaint::getFlags()
130 }; 131 };
131 132
132 /** 133 virtual bool onShouldDisableLCD(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 134
140 /** 135 /**
141 * 136 *
142 * DEPRECATED: This will be removed in a future change. Device subclasses 137 * 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. 138 * should use the matrix and clip from the SkDraw passed to draw functions.
144 * 139 *
145 * Called with the correct matrix and clip before this device is drawn 140 * 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 141 * to using those settings. If your subclass overrides this, be sure to
147 * call through to the base class as well. 142 * call through to the base class as well.
148 * 143 *
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 * of 'picture'. If optimization data is available (due to an earlier 326 * of 'picture'. If optimization data is available (due to an earlier
332 * 'optimize' call) this entry point should make use of it and return true 327 * 'optimize' call) this entry point should make use of it and return true
333 * if all rendering has been done. If false is returned, SkCanvas will 328 * if all rendering has been done. If false is returned, SkCanvas will
334 * perform its own rendering pass. It is acceptable for the backend 329 * perform its own rendering pass. It is acceptable for the backend
335 * to perform some device-specific warm up tasks and then let SkCanvas 330 * to perform some device-specific warm up tasks and then let SkCanvas
336 * perform the main rendering loop (by return false from here). 331 * perform the main rendering loop (by return false from here).
337 */ 332 */
338 virtual bool EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const SkM atrix*, 333 virtual bool EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const SkM atrix*,
339 const SkPaint*); 334 const SkPaint*);
340 335
341 void setPixelGeometry(SkPixelGeometry geo); 336 struct CreateInfo {
337 static SkPixelGeometry AdjustGeometry(const SkImageInfo&, Usage, SkPixel Geometry geo);
342 338
343 struct CreateInfo { 339 // The construct may change the pixel geometry based on usage as needed.
344 CreateInfo(const SkImageInfo& info, Usage usage) : fInfo(info), fUsage(u sage) {} 340 CreateInfo(const SkImageInfo& info, Usage usage, SkPixelGeometry geo)
341 : fInfo(info)
342 , fUsage(usage)
343 , fPixelGeometry(AdjustGeometry(info, usage, geo))
344 {}
345 345
346 SkImageInfo fInfo; 346 const SkImageInfo fInfo;
347 Usage fUsage; 347 const Usage fUsage;
348 const SkPixelGeometry fPixelGeometry;
348 }; 349 };
350
349 virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo& cinfo) { 351 virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo& cinfo) {
350 return NULL; 352 return NULL;
351 } 353 }
352 354
355 virtual void initForRootLayer(SkPixelGeometry geo);
356
353 private: 357 private:
354 friend class SkCanvas; 358 friend class SkCanvas;
355 friend struct DeviceCM; //for setMatrixClip 359 friend struct DeviceCM; //for setMatrixClip
356 friend class SkDraw; 360 friend class SkDraw;
357 friend class SkDrawIter; 361 friend class SkDrawIter;
358 friend class SkDeviceFilteredPaint; 362 friend class SkDeviceFilteredPaint;
359 friend class SkDeviceImageFilterProxy; 363 friend class SkDeviceImageFilterProxy;
360 friend class SkDeferredDevice; // for newSurface 364 friend class SkDeferredDevice; // for newSurface
361 365
362 friend class SkSurface_Raster; 366 friend class SkSurface_Raster;
363 367
364 // used to change the backend's pixels (and possibly config/rowbytes) 368 // used to change the backend's pixels (and possibly config/rowbytes)
365 // but cannot change the width/height, so there should be no change to 369 // but cannot change the width/height, so there should be no change to
366 // any clip information. 370 // any clip information.
367 // TODO: move to SkBitmapDevice 371 // TODO: move to SkBitmapDevice
368 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} 372 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {}
369 373
370 virtual bool forceConservativeRasterClip() const { return false; } 374 virtual bool forceConservativeRasterClip() const { return false; }
371 375
372 // just called by SkCanvas when built as a layer 376 // just called by SkCanvas when built as a layer
373 void setOrigin(int x, int y) { fOrigin.set(x, y); } 377 void setOrigin(int x, int y) { fOrigin.set(x, y); }
374 // just called by SkCanvas for saveLayer
375 SkBaseDevice* createCompatibleDeviceForSaveLayer(const SkImageInfo&);
376 // just called by SkCanvas for imagefilter
377 SkBaseDevice* createCompatibleDeviceForImageFilter(const SkImageInfo&);
378 378
379 /** Causes any deferred drawing to the device to be completed. 379 /** Causes any deferred drawing to the device to be completed.
380 */ 380 */
381 virtual void flush() {} 381 virtual void flush() {}
382 382
383 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } 383 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; }
384 384
385 SkIPoint fOrigin; 385 SkIPoint fOrigin;
386 SkMetaData* fMetaData; 386 SkMetaData* fMetaData;
387 SkDeviceProperties* fLeakyProperties; // will always exist. 387 SkDeviceProperties* fLeakyProperties; // will always exist.
388 388
389 #ifdef SK_DEBUG 389 #ifdef SK_DEBUG
390 bool fAttachedToCanvas; 390 bool fAttachedToCanvas;
391 #endif 391 #endif
392 392
393 typedef SkRefCnt INHERITED; 393 typedef SkRefCnt INHERITED;
394 }; 394 };
395 395
396 #endif 396 #endif
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698