| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
| 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 SkGpuDevice_DEFINED | 8 #ifndef SkGpuDevice_DEFINED |
| 9 #define SkGpuDevice_DEFINED | 9 #define SkGpuDevice_DEFINED |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 kClear_InitContents, | 35 kClear_InitContents, |
| 36 kUninit_InitContents | 36 kUninit_InitContents |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * Creates an SkGpuDevice from a GrRenderTarget. | 40 * Creates an SkGpuDevice from a GrRenderTarget. |
| 41 * TODO: rm this factory. It is used by SkSurface::MakeRenderTargetDirect, | 41 * TODO: rm this factory. It is used by SkSurface::MakeRenderTargetDirect, |
| 42 * MakeFromBackendTexture, MakeFromBackendRenderTarget, | 42 * MakeFromBackendTexture, MakeFromBackendRenderTarget, |
| 43 * and MakeFromBackendTextureAsRenderTarget. Only the first is worriso
me. | 43 * and MakeFromBackendTextureAsRenderTarget. Only the first is worriso
me. |
| 44 */ | 44 */ |
| 45 static sk_sp<SkGpuDevice> Make(sk_sp<GrRenderTarget> target, | 45 static sk_sp<SkGpuDevice> Make(int width, int height, |
| 46 sk_sp<GrRenderTarget> target, |
| 46 const SkSurfaceProps*, | 47 const SkSurfaceProps*, |
| 47 InitContents); | 48 InitContents); |
| 48 | 49 |
| 49 /** | 50 /** |
| 50 * Creates an SkGpuDevice from a GrDrawContext whose backing width/height is | 51 * Creates an SkGpuDevice from a GrDrawContext whose backing width/height is |
| 51 * different than its actual width/height (e.g., approx-match scratch textur
e). | 52 * different than its actual width/height (e.g., approx-match scratch textur
e). |
| 52 */ | 53 */ |
| 53 static sk_sp<SkBaseDevice> Make(sk_sp<GrDrawContext> drawContext, | 54 static sk_sp<SkBaseDevice> Make(sk_sp<GrDrawContext> drawContext, InitConten
ts); |
| 54 int width, int height, | |
| 55 InitContents); | |
| 56 | 55 |
| 57 /** | 56 /** |
| 58 * New device that will create an offscreen renderTarget based on the ImageI
nfo and | 57 * New device that will create an offscreen renderTarget based on the ImageI
nfo and |
| 59 * sampleCount. The Budgeted param controls whether the device's backing sto
re counts against | 58 * sampleCount. The Budgeted param controls whether the device's backing sto
re counts against |
| 60 * the resource cache budget. On failure, returns nullptr. | 59 * the resource cache budget. On failure, returns nullptr. |
| 61 */ | 60 */ |
| 62 static sk_sp<SkGpuDevice> Make(GrContext*, SkBudgeted, const SkImageInfo&, | 61 static sk_sp<SkGpuDevice> Make(GrContext*, SkBudgeted, const SkImageInfo&, |
| 63 int sampleCount, const SkSurfaceProps*, InitC
ontents); | 62 int sampleCount, const SkSurfaceProps*, InitC
ontents); |
| 64 | 63 |
| 65 ~SkGpuDevice() override {} | 64 ~SkGpuDevice() override {} |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 bool fOpaque; | 165 bool fOpaque; |
| 167 | 166 |
| 168 enum Flags { | 167 enum Flags { |
| 169 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear | 168 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear |
| 170 kIsOpaque_Flag = 1 << 1, //!< Hint from client that rendering to this
device will be | 169 kIsOpaque_Flag = 1 << 1, //!< Hint from client that rendering to this
device will be |
| 171 // opaque even if the config supports alpha
. | 170 // opaque even if the config supports alpha
. |
| 172 }; | 171 }; |
| 173 static bool CheckAlphaTypeAndGetFlags(const SkImageInfo* info, InitContents
init, | 172 static bool CheckAlphaTypeAndGetFlags(const SkImageInfo* info, InitContents
init, |
| 174 unsigned* flags); | 173 unsigned* flags); |
| 175 | 174 |
| 176 SkGpuDevice(sk_sp<GrDrawContext>, int width, int height, unsigned flags); | 175 SkGpuDevice(sk_sp<GrDrawContext>, unsigned flags); |
| 177 | 176 |
| 178 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; | 177 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; |
| 179 | 178 |
| 180 sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&) over
ride; | 179 sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&) over
ride; |
| 181 | 180 |
| 182 SkImageFilterCache* getImageFilterCache() override; | 181 SkImageFilterCache* getImageFilterCache() override; |
| 183 | 182 |
| 184 bool forceConservativeRasterClip() const override { return true; } | 183 bool forceConservativeRasterClip() const override { return true; } |
| 185 | 184 |
| 186 // sets the render target and clip on context | 185 // sets the render target and clip on context |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 270 |
| 272 void drawSpriteWithFilter(const SkDraw&, const SkBitmap&, int x, int y, | 271 void drawSpriteWithFilter(const SkDraw&, const SkBitmap&, int x, int y, |
| 273 const SkPaint&) override; | 272 const SkPaint&) override; |
| 274 | 273 |
| 275 friend class GrAtlasTextContext; | 274 friend class GrAtlasTextContext; |
| 276 friend class SkSurface_Gpu; // for access to surfaceProps | 275 friend class SkSurface_Gpu; // for access to surfaceProps |
| 277 typedef SkBaseDevice INHERITED; | 276 typedef SkBaseDevice INHERITED; |
| 278 }; | 277 }; |
| 279 | 278 |
| 280 #endif | 279 #endif |
| OLD | NEW |