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

Side by Side Diff: cc/resources/ui_resource_bitmap.cc

Issue 27973002: cc: Adding ETC1 support to UIResourceBitmap and ResourceProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/resources/ui_resource_bitmap.h" 5 #include "cc/resources/ui_resource_bitmap.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
10 10
(...skipping 19 matching lines...) Expand all
30 DCHECK_EQ(skbitmap.width(), skbitmap.rowBytesAsPixels()); 30 DCHECK_EQ(skbitmap.width(), skbitmap.rowBytesAsPixels());
31 DCHECK(skbitmap.isImmutable()); 31 DCHECK(skbitmap.isImmutable());
32 32
33 skia::RefPtr<SkPixelRef> pixel_ref = skia::SharePtr(skbitmap.pixelRef()); 33 skia::RefPtr<SkPixelRef> pixel_ref = skia::SharePtr(skbitmap.pixelRef());
34 Create(pixel_ref, 34 Create(pixel_ref,
35 UIResourceBitmap::RGBA8, 35 UIResourceBitmap::RGBA8,
36 wrap_mode, 36 wrap_mode,
37 gfx::Size(skbitmap.width(), skbitmap.height())); 37 gfx::Size(skbitmap.width(), skbitmap.height()));
38 } 38 }
39 39
40 UIResourceBitmap::UIResourceBitmap(const skia::RefPtr<SkPixelRef>& pixel_ref,
41 UIResourceFormat format,
42 UIResourceWrapMode wrap_mode,
43 gfx::Size size) {
44 Create(pixel_ref, format, wrap_mode, size);
45 }
46
40 UIResourceBitmap::~UIResourceBitmap() {} 47 UIResourceBitmap::~UIResourceBitmap() {}
41 48
42 AutoLockUIResourceBitmap::AutoLockUIResourceBitmap( 49 AutoLockUIResourceBitmap::AutoLockUIResourceBitmap(
43 const UIResourceBitmap& bitmap) : bitmap_(bitmap) { 50 const UIResourceBitmap& bitmap) : bitmap_(bitmap) {
44 bitmap_.pixel_ref_->lockPixels(); 51 bitmap_.pixel_ref_->lockPixels();
45 } 52 }
46 53
47 AutoLockUIResourceBitmap::~AutoLockUIResourceBitmap() { 54 AutoLockUIResourceBitmap::~AutoLockUIResourceBitmap() {
48 bitmap_.pixel_ref_->unlockPixels(); 55 bitmap_.pixel_ref_->unlockPixels();
49 } 56 }
50 57
51 const uint8_t* AutoLockUIResourceBitmap::GetPixels() const { 58 const uint8_t* AutoLockUIResourceBitmap::GetPixels() const {
52 return static_cast<const uint8_t*>(bitmap_.pixel_ref_->pixels()); 59 return static_cast<const uint8_t*>(bitmap_.pixel_ref_->pixels());
53 } 60 }
54 61
55 } // namespace cc 62 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698