| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 SkImage_Gpu_DEFINED | 8 #ifndef SkImage_Gpu_DEFINED |
| 9 #define SkImage_Gpu_DEFINED | 9 #define SkImage_Gpu_DEFINED |
| 10 | 10 |
| 11 #include "GrTexture.h" | 11 #include "GrTexture.h" |
| 12 #include "GrGpuResourcePriv.h" | 12 #include "GrGpuResourcePriv.h" |
| 13 #include "SkBitmap.h" | 13 #include "SkBitmap.h" |
| 14 #include "SkImage_Base.h" | 14 #include "SkImage_Base.h" |
| 15 #include "SkImagePriv.h" | 15 #include "SkImagePriv.h" |
| 16 #include "SkSurface.h" | 16 #include "SkSurface.h" |
| 17 | 17 |
| 18 class SkImage_Gpu : public SkImage_Base { | 18 class SkImage_Gpu : public SkImage_Base { |
| 19 public: | 19 public: |
| 20 SK_DECLARE_INST_COUNT(SkImage_Gpu) | 20 SK_DECLARE_INST_COUNT(SkImage_Gpu) |
| 21 | 21 |
| 22 SkImage_Gpu(const SkBitmap&, int sampleCountForNewSurfaces, SkSurface::Budge
ted); | 22 SkImage_Gpu(const SkBitmap&, int sampleCountForNewSurfaces, SkSurface::Budge
ted); |
| 23 | 23 |
| 24 void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const overrid
e; | |
| 25 void onDrawRect(SkCanvas*, const SkRect* src, const SkRect& dst, | |
| 26 const SkPaint*) const override; | |
| 27 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const ove
rride; | 24 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const ove
rride; |
| 28 GrTexture* onGetTexture() const override; | 25 GrTexture* onGetTexture() const override; |
| 29 bool getROPixels(SkBitmap*) const override; | 26 bool getROPixels(SkBitmap*) const override; |
| 30 | 27 |
| 31 GrTexture* getTexture() const { return fBitmap.getTexture(); } | 28 GrTexture* getTexture() const { return fBitmap.getTexture(); } |
| 32 | 29 |
| 33 SkShader* onNewShader(SkShader::TileMode, | 30 SkShader* onNewShader(SkShader::TileMode, |
| 34 SkShader::TileMode, | 31 SkShader::TileMode, |
| 35 const SkMatrix* localMatrix) const override; | 32 const SkMatrix* localMatrix) const override; |
| 36 | 33 |
| 37 bool isOpaque() const override; | 34 bool isOpaque() const override; |
| 38 | 35 |
| 39 void applyBudgetDecision() const { | 36 void applyBudgetDecision() const { |
| 40 if (fBudgeted) { | 37 if (fBudgeted) { |
| 41 fBitmap.getTexture()->resourcePriv().makeBudgeted(); | 38 fBitmap.getTexture()->resourcePriv().makeBudgeted(); |
| 42 } else { | 39 } else { |
| 43 fBitmap.getTexture()->resourcePriv().makeUnbudgeted(); | 40 fBitmap.getTexture()->resourcePriv().makeUnbudgeted(); |
| 44 } | 41 } |
| 45 } | 42 } |
| 46 | 43 |
| 47 private: | 44 private: |
| 48 SkBitmap fBitmap; | 45 SkBitmap fBitmap; |
| 49 const int fSampleCountForNewSurfaces; // 0 if we don't know | 46 const int fSampleCountForNewSurfaces; // 0 if we don't know |
| 50 SkSurface::Budgeted fBudgeted; | 47 SkSurface::Budgeted fBudgeted; |
| 51 | 48 |
| 52 typedef SkImage_Base INHERITED; | 49 typedef SkImage_Base INHERITED; |
| 53 }; | 50 }; |
| 54 | 51 |
| 55 #endif | 52 #endif |
| OLD | NEW |