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

Side by Side Diff: src/core/SkBitmapController.h

Issue 1346713002: move SkBitmapProvider to its own file (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix spelling Created 5 years, 3 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 | « gyp/core.gypi ('k') | src/core/SkBitmapController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 SkBitmapController_DEFINED 8 #ifndef SkBitmapController_DEFINED
9 #define SkBitmapController_DEFINED 9 #define SkBitmapController_DEFINED
10 10
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 #include "SkBitmapCache.h" 12 #include "SkBitmapCache.h"
13 #include "SkFilterQuality.h" 13 #include "SkFilterQuality.h"
14 #include "SkImage.h"
15 #include "SkMatrix.h" 14 #include "SkMatrix.h"
16 15
17 class SkBitmapProvider { 16 class SkBitmapProvider;
18 public:
19 explicit SkBitmapProvider(const SkBitmap& bm) : fBitmap(bm) {}
20 explicit SkBitmapProvider(const SkImage* img) : fImage(SkSafeRef(img)) {}
21 SkBitmapProvider(const SkBitmapProvider& other)
22 : fBitmap(other.fBitmap)
23 , fImage(SkSafeRef(other.fImage.get()))
24 {}
25
26 int width() const;
27 int height() const;
28 uint32_t getID() const;
29
30 bool validForDrawing() const;
31 SkImageInfo info() const;
32
33 SkBitmapCacheDesc makeCacheDesc(int w, int h) const;
34 SkBitmapCacheDesc makeCacheDesc() const;
35 void notifyAddedToCache() const;
36
37 // Only call this if you're sure you need the bits, since it make be expensi ve
38 // ... cause a decode and cache, or gpu-readback
39 bool asBitmap(SkBitmap*) const;
40
41 private:
42 SkBitmap fBitmap;
43 SkAutoTUnref<const SkImage> fImage;
44 };
45 17
46 /** 18 /**
47 * Handles request to scale, filter, and lock a bitmap to be rasterized. 19 * Handles request to scale, filter, and lock a bitmap to be rasterized.
48 */ 20 */
49 class SkBitmapController : ::SkNoncopyable { 21 class SkBitmapController : ::SkNoncopyable {
50 public: 22 public:
51 class State : ::SkNoncopyable { 23 class State : ::SkNoncopyable {
52 public: 24 public:
53 virtual ~State() {} 25 virtual ~State() {}
54 26
(...skipping 29 matching lines...) Expand all
84 class SkDefaultBitmapController : public SkBitmapController { 56 class SkDefaultBitmapController : public SkBitmapController {
85 public: 57 public:
86 SkDefaultBitmapController() {} 58 SkDefaultBitmapController() {}
87 59
88 protected: 60 protected:
89 State* onRequestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkF ilterQuality, 61 State* onRequestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkF ilterQuality,
90 void* storage, size_t storageSize) override; 62 void* storage, size_t storageSize) override;
91 }; 63 };
92 64
93 #endif 65 #endif
OLDNEW
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkBitmapController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698