Chromium Code Reviews| 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 "GrContext.h" | 19 #include "GrContext.h" |
| 19 #include "GrSurfacePriv.h" | 20 #include "GrSurfacePriv.h" |
| 20 | 21 |
| 21 class GrAccelData; | 22 class GrAccelData; |
| 22 class GrTextureProducer; | 23 class GrTextureProducer; |
| 23 struct GrCachedLayer; | 24 struct GrCachedLayer; |
| 24 | 25 |
| 25 /** | 26 /** |
| 26 * Subclass of SkBaseDevice, which directs all drawing to the GrGpu owned by th e | 27 * Subclass of SkBaseDevice, which directs all drawing to the GrGpu owned by th e |
| 27 * canvas. | 28 * canvas. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 45 static SkGpuDevice* Create(GrRenderTarget* target, int width, int height, | 46 static SkGpuDevice* Create(GrRenderTarget* target, int width, int height, |
| 46 const SkSurfaceProps*, InitContents); | 47 const SkSurfaceProps*, InitContents); |
| 47 | 48 |
| 48 /** | 49 /** |
| 49 * New device that will create an offscreen renderTarget based on the ImageI nfo and | 50 * New device that will create an offscreen renderTarget based on the ImageI nfo and |
| 50 * sampleCount. The Budgeted param controls whether the device's backing sto re counts against | 51 * sampleCount. The Budgeted param controls whether the device's backing sto re counts against |
| 51 * the resource cache budget. On failure, returns nullptr. | 52 * the resource cache budget. On failure, returns nullptr. |
| 52 */ | 53 */ |
| 53 static SkGpuDevice* Create(GrContext*, SkSurface::Budgeted, const SkImageInf o&, | 54 static SkGpuDevice* Create(GrContext*, SkSurface::Budgeted, const SkImageInf o&, |
| 54 int sampleCount, const SkSurfaceProps*, InitConte nts); | 55 int sampleCount, const SkSurfaceProps*, InitConte nts); |
| 55 | 56 |
|
robertphillips
2016/01/07 22:08:39
Shouldn't this actually be override ?
| |
| 56 virtual ~SkGpuDevice(); | 57 virtual ~SkGpuDevice() {} |
| 57 | 58 |
| 58 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { | 59 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { |
| 59 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k Possible_TileUsage, | 60 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k Possible_TileUsage, |
| 60 props.pixelGeometry( )), | 61 props.pixelGeometry( )), |
| 61 nullptr); | 62 nullptr); |
| 62 return static_cast<SkGpuDevice*>(dev); | 63 return static_cast<SkGpuDevice*>(dev); |
| 63 } | 64 } |
| 64 | 65 |
| 65 GrContext* context() const { return fContext; } | 66 GrContext* context() const { return fContext; } |
| 66 | 67 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 | 146 |
| 146 protected: | 147 protected: |
| 147 bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) override; | 148 bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) override; |
| 148 bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) overri de; | 149 bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) overri de; |
| 149 bool onShouldDisableLCD(const SkPaint&) const final; | 150 bool onShouldDisableLCD(const SkPaint&) const final; |
| 150 | 151 |
| 151 /** PRIVATE / EXPERIMENTAL -- do not call */ | 152 /** PRIVATE / EXPERIMENTAL -- do not call */ |
| 152 virtual bool EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pic ture, | 153 virtual bool EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pic ture, |
| 153 const SkMatrix*, const SkPaint*) overr ide; | 154 const SkMatrix*, const SkPaint*) overr ide; |
| 154 | 155 |
| 155 private: | 156 private: |
|
robertphillips
2016/01/07 22:08:39
// We want these unreffed in DrawContext, RenderTa
| |
| 156 GrContext* fContext; | 157 SkAutoTUnref<GrContext> fContext; |
| 158 SkAutoTUnref<GrRenderTarget> fRenderTarget; | |
| 159 SkAutoTUnref<GrDrawContext> fDrawContext; | |
| 160 | |
| 157 SkAutoTUnref<const SkClipStack> fClipStack; | 161 SkAutoTUnref<const SkClipStack> fClipStack; |
| 158 SkIPoint fClipOrigin; | 162 SkIPoint fClipOrigin; |
| 159 GrClip fClip; | 163 GrClip fClip;; |
| 160 SkAutoTUnref<GrDrawContext> fDrawContext; | |
| 161 GrRenderTarget* fRenderTarget; | |
| 162 // remove when our clients don't rely on accessBitmap() | 164 // remove when our clients don't rely on accessBitmap() |
| 163 SkBitmap fLegacyBitmap; | 165 SkBitmap fLegacyBitmap; |
| 164 bool fNeedClear; | 166 bool fNeedClear; |
| 165 bool fOpaque; | 167 bool fOpaque; |
| 166 | 168 |
| 167 enum Flags { | 169 enum Flags { |
| 168 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear | 170 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear |
| 169 kIsOpaque_Flag = 1 << 1, //!< Hint from client that rendering to this device will be | 171 kIsOpaque_Flag = 1 << 1, //!< Hint from client that rendering to this device will be |
| 170 // opaque even if the config supports alpha . | 172 // opaque even if the config supports alpha . |
| 171 }; | 173 }; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 | 256 |
| 255 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c onst SkImageInfo&, | 257 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c onst SkImageInfo&, |
| 256 int sampleCount); | 258 int sampleCount); |
| 257 | 259 |
| 258 friend class GrAtlasTextContext; | 260 friend class GrAtlasTextContext; |
| 259 friend class SkSurface_Gpu; // for access to surfaceProps | 261 friend class SkSurface_Gpu; // for access to surfaceProps |
| 260 typedef SkBaseDevice INHERITED; | 262 typedef SkBaseDevice INHERITED; |
| 261 }; | 263 }; |
| 262 | 264 |
| 263 #endif | 265 #endif |
| OLD | NEW |