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

Side by Side Diff: src/image/SkImage_Gpu.h

Issue 872543002: Take budgeted param when snapping new image. (Closed) Base URL: https://skia.googlesource.com/skia.git@budgeted
Patch Set: Address comment and rebase Created 5 years, 11 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 | « src/image/SkImagePriv.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkImage_Gpu_DEFINED
9 #define SkImage_Gpu_DEFINED
10
11 #include "GrTexture.h"
12 #include "GrGpuResourceCacheAccess.h"
13 #include "SkBitmap.h"
14 #include "SkImage_Base.h"
15 #include "SkImagePriv.h"
16 #include "SkSurface.h"
17
18 class SkImage_Gpu : public SkImage_Base {
19 public:
20 SK_DECLARE_INST_COUNT(SkImage_Gpu)
21
22 SkImage_Gpu(const SkBitmap&, int sampleCountForNewSurfaces, SkSurface::Budge ted);
23
24 void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const SK_OVER RIDE;
25 void onDrawRect(SkCanvas*, const SkRect* src, const SkRect& dst,
26 const SkPaint*) const SK_OVERRIDE;
27 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) const SK_ OVERRIDE;
28 GrTexture* onGetTexture() const SK_OVERRIDE;
29 bool getROPixels(SkBitmap*) const SK_OVERRIDE;
30
31 GrTexture* getTexture() const { return fBitmap.getTexture(); }
32
33 SkShader* onNewShader(SkShader::TileMode,
34 SkShader::TileMode,
35 const SkMatrix* localMatrix) const SK_OVERRIDE ;
36
37 bool isOpaque() const SK_OVERRIDE;
38
39 void applyBudgetDecision() const {
40 if (fBudgeted) {
41 fBitmap.getTexture()->cacheAccess().makeBudgeted();
42 } else {
43 fBitmap.getTexture()->cacheAccess().makeUnbudgeted();
44 }
45 }
46
47 private:
48 SkBitmap fBitmap;
49 const int fSampleCountForNewSurfaces; // 0 if we don't know
50 SkSurface::Budgeted fBudgeted;
51
52 typedef SkImage_Base INHERITED;
53 };
54
55 #endif
OLDNEW
« no previous file with comments | « src/image/SkImagePriv.h ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698