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

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

Issue 2261003003: store info in basedevice, change getter to non-virtual const& (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 months 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/SkBitmapDevice.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 12 matching lines...) Expand all
23 class SkMetaData; 23 class SkMetaData;
24 class SkRegion; 24 class SkRegion;
25 class SkSpecialImage; 25 class SkSpecialImage;
26 class GrRenderTarget; 26 class GrRenderTarget;
27 27
28 class SK_API SkBaseDevice : public SkRefCnt { 28 class SK_API SkBaseDevice : public SkRefCnt {
29 public: 29 public:
30 /** 30 /**
31 * Construct a new device. 31 * Construct a new device.
32 */ 32 */
33 explicit SkBaseDevice(const SkSurfaceProps&); 33 explicit SkBaseDevice(const SkImageInfo&, const SkSurfaceProps&);
34 virtual ~SkBaseDevice(); 34 virtual ~SkBaseDevice();
35 35
36 SkMetaData& getMetaData(); 36 SkMetaData& getMetaData();
37 37
38 /** 38 /**
39 * Return ImageInfo for this device. If the canvas is not backed by pixels 39 * Return ImageInfo for this device. If the canvas is not backed by pixels
40 * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType. 40 * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType.
41 */ 41 */
42 virtual SkImageInfo imageInfo() const; 42 const SkImageInfo& imageInfo() const { return fInfo; }
43 43
44 /** 44 /**
45 * Return SurfaceProps for this device. 45 * Return SurfaceProps for this device.
46 */ 46 */
47 const SkSurfaceProps& surfaceProps() const { 47 const SkSurfaceProps& surfaceProps() const {
48 return fSurfaceProps; 48 return fSurfaceProps;
49 } 49 }
50 50
51 /** 51 /**
52 * Return the bounds of the device in the coordinate space of the root 52 * Return the bounds of the device in the coordinate space of the root
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 364
365 // just called by SkCanvas when built as a layer 365 // just called by SkCanvas when built as a layer
366 void setOrigin(int x, int y) { fOrigin.set(x, y); } 366 void setOrigin(int x, int y) { fOrigin.set(x, y); }
367 367
368 /** Causes any deferred drawing to the device to be completed. 368 /** Causes any deferred drawing to the device to be completed.
369 */ 369 */
370 virtual void flush() {} 370 virtual void flush() {}
371 371
372 virtual SkImageFilterCache* getImageFilterCache() { return NULL; } 372 virtual SkImageFilterCache* getImageFilterCache() { return NULL; }
373 373
374 friend class SkBitmapDevice;
375 void privateResize(int w, int h) {
376 *const_cast<SkImageInfo*>(&fInfo) = fInfo.makeWH(w, h);
bsalomon 2016/08/20 14:57:29 why not just make it non-const? Also, there's a wh
377 }
378
374 SkIPoint fOrigin; 379 SkIPoint fOrigin;
375 SkMetaData* fMetaData; 380 SkMetaData* fMetaData;
376 SkSurfaceProps fSurfaceProps; 381 const SkImageInfo fInfo;
382 const SkSurfaceProps fSurfaceProps;
377 383
378 #ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP 384 #ifdef SK_SUPPORT_LEGACY_ACCESSBITMAP
379 SkBitmap fLegacyBitmap; 385 SkBitmap fLegacyBitmap;
380 #endif 386 #endif
381 387
382 typedef SkRefCnt INHERITED; 388 typedef SkRefCnt INHERITED;
383 }; 389 };
384 390
385 #endif 391 #endif
OLDNEW
« no previous file with comments | « include/core/SkBitmapDevice.h ('k') | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698