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

Unified Diff: cc/resources/ui_resource_bitmap.cc

Issue 2293573002: Add tinted static UI resource cache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: cc/resources/ui_resource_bitmap.cc
diff --git a/cc/resources/ui_resource_bitmap.cc b/cc/resources/ui_resource_bitmap.cc
index 9c42bd811fd527c1bd91db5bf0a47db538323e25..d60e0a639be879da51d6653310f5b20d6150949f 100644
--- a/cc/resources/ui_resource_bitmap.cc
+++ b/cc/resources/ui_resource_bitmap.cc
@@ -9,7 +9,7 @@
#include <memory>
#include "base/logging.h"
-#include "third_party/skia/include/core/SkBitmap.h"
+#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkMallocPixelRef.h"
#include "third_party/skia/include/core/SkPixelRef.h"
@@ -50,6 +50,14 @@ void UIResourceBitmap::Create(sk_sp<SkPixelRef> pixel_ref,
opaque_ = (format == ETC1);
}
+void UIResourceBitmap::Draw(SkCanvas& canvas, SkPaint& paint) {
+ SkBitmap bitmap;
+ bitmap.setInfo(pixel_ref_.get()->info(), pixel_ref_.get()->rowBytes());
+ bitmap.setPixelRef(pixel_ref_.get());
+ canvas.drawBitmap(bitmap, 0, 0, &paint);
+ canvas.flush();
+}
+
UIResourceBitmap::UIResourceBitmap(const SkBitmap& skbitmap) {
DCHECK_EQ(skbitmap.width(), skbitmap.rowBytesAsPixels());
DCHECK(skbitmap.isImmutable());

Powered by Google App Engine
This is Rietveld 408576698