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/core/SkBitmapProvider.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 | « src/core/SkBitmapProcState.h ('k') | src/core/SkBitmapProvider.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 SkBitmapProvider_DEFINED
9 #define SkBitmapProvider_DEFINED
10
11 #include "SkBitmap.h"
12 #include "SkImage.h"
13 #include "SkBitmapCache.h"
14
15 class SkBitmapProvider {
16 public:
17 explicit SkBitmapProvider(const SkBitmap& bm) : fBitmap(bm) {}
18 explicit SkBitmapProvider(const SkImage* img) : fImage(SkSafeRef(img)) {}
19 SkBitmapProvider(const SkBitmapProvider& other)
20 : fBitmap(other.fBitmap)
21 , fImage(SkSafeRef(other.fImage.get()))
22 {}
23
24 int width() const;
25 int height() const;
26 uint32_t getID() const;
27
28 bool validForDrawing() const;
29 SkImageInfo info() const;
30
31 SkBitmapCacheDesc makeCacheDesc(int w, int h) const;
32 SkBitmapCacheDesc makeCacheDesc() const;
33 void notifyAddedToCache() const;
34
35 // Only call this if you're sure you need the bits, since it maybe expensive
36 // ... cause a decode and cache, or gpu-readback
37 bool asBitmap(SkBitmap*) const;
38
39 private:
40 SkBitmap fBitmap;
41 SkAutoTUnref<const SkImage> fImage;
42 };
43
44 #endif
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState.h ('k') | src/core/SkBitmapProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698