| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef SkGpuDevice_DEFINED | 9 #ifndef SkGpuDevice_DEFINED |
| 10 #define SkGpuDevice_DEFINED | 10 #define SkGpuDevice_DEFINED |
| 11 | 11 |
| 12 #include "SkGr.h" | 12 #include "SkGr.h" |
| 13 #include "SkBitmap.h" | 13 #include "SkBitmap.h" |
| 14 #include "SkDevice.h" | 14 #include "SkDevice.h" |
| 15 #include "SkPicture.h" | 15 #include "SkPicture.h" |
| 16 #include "SkRegion.h" | 16 #include "SkRegion.h" |
| 17 #include "SkSurface.h" | 17 #include "SkSurface.h" |
| 18 #include "GrDrawContext.h" | 18 #include "GrDrawContext.h" |
| 19 #include "GrContext.h" | 19 #include "GrContext.h" |
| 20 #include "GrSurfacePriv.h" | 20 #include "GrSurfacePriv.h" |
| 21 #include "GrTypes.h" | 21 #include "GrTypes.h" |
| 22 | 22 |
| 23 class GrAccelData; | 23 class GrAccelData; |
| 24 class GrTextureProducer; | 24 class GrTextureProducer; |
| 25 struct GrCachedLayer; | 25 struct GrCachedLayer; |
| 26 class SkRasterCanvasLayerAllocator; |
| 26 | 27 |
| 27 /** | 28 /** |
| 28 * Subclass of SkBaseDevice, which directs all drawing to the GrGpu owned by th
e | 29 * Subclass of SkBaseDevice, which directs all drawing to the GrGpu owned by th
e |
| 29 * canvas. | 30 * canvas. |
| 30 */ | 31 */ |
| 31 class SK_API SkGpuDevice : public SkBaseDevice { | 32 class SK_API SkGpuDevice : public SkBaseDevice { |
| 32 public: | 33 public: |
| 33 enum InitContents { | 34 enum InitContents { |
| 34 kClear_InitContents, | 35 kClear_InitContents, |
| 35 kUninit_InitContents | 36 kUninit_InitContents |
| (...skipping 18 matching lines...) Expand all Loading... |
| 54 */ | 55 */ |
| 55 static SkGpuDevice* Create(GrContext*, SkBudgeted, const SkImageInfo&, | 56 static SkGpuDevice* Create(GrContext*, SkBudgeted, const SkImageInfo&, |
| 56 int sampleCount, const SkSurfaceProps*, | 57 int sampleCount, const SkSurfaceProps*, |
| 57 InitContents, GrTextureStorageAllocator = GrTextu
reStorageAllocator()); | 58 InitContents, GrTextureStorageAllocator = GrTextu
reStorageAllocator()); |
| 58 | 59 |
| 59 ~SkGpuDevice() override {} | 60 ~SkGpuDevice() override {} |
| 60 | 61 |
| 61 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { | 62 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { |
| 62 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k
Possible_TileUsage, | 63 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k
Possible_TileUsage, |
| 63 props.pixelGeometry(
)), | 64 props.pixelGeometry(
)), |
| 64 nullptr); | 65 nullptr, nullptr); |
| 65 return static_cast<SkGpuDevice*>(dev); | 66 return static_cast<SkGpuDevice*>(dev); |
| 66 } | 67 } |
| 67 | 68 |
| 68 GrContext* context() const { return fContext; } | 69 GrContext* context() const { return fContext; } |
| 69 | 70 |
| 70 // set all pixels to 0 | 71 // set all pixels to 0 |
| 71 void clearAll(); | 72 void clearAll(); |
| 72 | 73 |
| 73 void replaceRenderTarget(bool shouldRetainContent); | 74 void replaceRenderTarget(bool shouldRetainContent); |
| 74 | 75 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 enum Flags { | 172 enum Flags { |
| 172 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear | 173 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear |
| 173 kIsOpaque_Flag = 1 << 1, //!< Hint from client that rendering to this
device will be | 174 kIsOpaque_Flag = 1 << 1, //!< Hint from client that rendering to this
device will be |
| 174 // opaque even if the config supports alpha
. | 175 // opaque even if the config supports alpha
. |
| 175 }; | 176 }; |
| 176 static bool CheckAlphaTypeAndGetFlags(const SkImageInfo* info, InitContents
init, | 177 static bool CheckAlphaTypeAndGetFlags(const SkImageInfo* info, InitContents
init, |
| 177 unsigned* flags); | 178 unsigned* flags); |
| 178 | 179 |
| 179 SkGpuDevice(GrRenderTarget*, int width, int height, const SkSurfaceProps*, u
nsigned flags); | 180 SkGpuDevice(GrRenderTarget*, int width, int height, const SkSurfaceProps*, u
nsigned flags); |
| 180 | 181 |
| 181 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; | 182 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*, |
| 183 SkRasterCanvasLayerAllocator*) override; |
| 182 | 184 |
| 183 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override; | 185 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override; |
| 184 | 186 |
| 185 SkImageFilter::Cache* getImageFilterCache() override; | 187 SkImageFilter::Cache* getImageFilterCache() override; |
| 186 | 188 |
| 187 bool forceConservativeRasterClip() const override { return true; } | 189 bool forceConservativeRasterClip() const override { return true; } |
| 188 | 190 |
| 189 // sets the render target and clip on context | 191 // sets the render target and clip on context |
| 190 void prepareDraw(const SkDraw&); | 192 void prepareDraw(const SkDraw&); |
| 191 | 193 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 263 |
| 262 static GrRenderTarget* CreateRenderTarget(GrContext*, SkBudgeted, const SkIm
ageInfo&, | 264 static GrRenderTarget* CreateRenderTarget(GrContext*, SkBudgeted, const SkIm
ageInfo&, |
| 263 int sampleCount, GrTextureStorageA
llocator); | 265 int sampleCount, GrTextureStorageA
llocator); |
| 264 | 266 |
| 265 friend class GrAtlasTextContext; | 267 friend class GrAtlasTextContext; |
| 266 friend class SkSurface_Gpu; // for access to surfaceProps | 268 friend class SkSurface_Gpu; // for access to surfaceProps |
| 267 typedef SkBaseDevice INHERITED; | 269 typedef SkBaseDevice INHERITED; |
| 268 }; | 270 }; |
| 269 | 271 |
| 270 #endif | 272 #endif |
| OLD | NEW |