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

Unified Diff: cc/resources/resource_provider.h

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/picture_pile.cc ('k') | cc/resources/resource_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_provider.h
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h
index c2f349ff05fd7b12309fce72005586d64047dbd0..bfd3ebb304765b255a31baa03861b9aa20d4cba2 100644
--- a/cc/resources/resource_provider.h
+++ b/cc/resources/resource_provider.h
@@ -296,14 +296,13 @@ class CC_EXPORT ResourceProvider {
ResourceProvider::ResourceId resource_id);
~ScopedWriteLockSoftware();
- SkCanvas* sk_canvas() { return sk_canvas_.get(); }
+ SkBitmap& sk_bitmap() { return sk_bitmap_; }
bool valid() const { return !!sk_bitmap_.getPixels(); }
private:
ResourceProvider* resource_provider_;
ResourceProvider::Resource* resource_;
SkBitmap sk_bitmap_;
- scoped_ptr<SkCanvas> sk_canvas_;
base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware);
@@ -599,21 +598,24 @@ class CC_EXPORT ResourceProvider {
DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
};
-
// TODO(epenner): Move these format conversions to resource_format.h
// once that builds on mac (npapi.h currently #includes OpenGL.h).
inline unsigned BitsPerPixel(ResourceFormat format) {
- DCHECK_LE(format, RESOURCE_FORMAT_MAX);
- static const unsigned format_bits_per_pixel[RESOURCE_FORMAT_MAX + 1] = {
- 32, // RGBA_8888
- 16, // RGBA_4444
- 32, // BGRA_8888
- 8, // ALPHA_8
- 8, // LUMINANCE_8
- 16, // RGB_565,
- 4 // ETC1
- };
- return format_bits_per_pixel[format];
+ switch (format) {
+ case BGRA_8888:
+ case RGBA_8888:
+ return 32;
+ case RGBA_4444:
+ case RGB_565:
+ return 16;
+ case ALPHA_8:
+ case LUMINANCE_8:
+ return 8;
+ case ETC1:
+ return 4;
+ }
+ NOTREACHED();
+ return 0;
}
inline GLenum GLDataType(ResourceFormat format) {
« no previous file with comments | « cc/resources/picture_pile.cc ('k') | cc/resources/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698