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

Unified Diff: cc/test/skia_common.cc

Issue 1531403002: Revert "Delete CC." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years 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/test/skia_common.h ('k') | cc/test/test_context_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/skia_common.cc
diff --git a/cc/test/skia_common.cc b/cc/test/skia_common.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ef61e217fc52adfc5468750230087a4d11a2e78f
--- /dev/null
+++ b/cc/test/skia_common.cc
@@ -0,0 +1,50 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/test/skia_common.h"
+
+#include "cc/resources/display_item_list.h"
+#include "cc/resources/picture.h"
+#include "skia/ext/refptr.h"
+#include "third_party/skia/include/core/SkCanvas.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/skia_util.h"
+
+namespace cc {
+
+void DrawPicture(unsigned char* buffer,
+ const gfx::Rect& layer_rect,
+ scoped_refptr<Picture> picture) {
+ SkImageInfo info =
+ SkImageInfo::MakeN32Premul(layer_rect.width(), layer_rect.height());
+ SkBitmap bitmap;
+ bitmap.installPixels(info, buffer, info.minRowBytes());
+ SkCanvas canvas(bitmap);
+ canvas.clipRect(gfx::RectToSkRect(layer_rect));
+ // We're drawing the entire canvas, so the negated content region is empty.
+ gfx::Rect negated_content_region;
+ picture->Raster(&canvas, NULL, negated_content_region, 1.0f);
+}
+
+void DrawDisplayList(unsigned char* buffer,
+ const gfx::Rect& layer_rect,
+ scoped_refptr<DisplayItemList> list) {
+ SkImageInfo info =
+ SkImageInfo::MakeN32Premul(layer_rect.width(), layer_rect.height());
+ SkBitmap bitmap;
+ bitmap.installPixels(info, buffer, info.minRowBytes());
+ SkCanvas canvas(bitmap);
+ canvas.clipRect(gfx::RectToSkRect(layer_rect));
+ list->Raster(&canvas, NULL, 1.0f);
+}
+
+void CreateBitmap(const gfx::Size& size, const char* uri, SkBitmap* bitmap) {
+ SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height());
+
+ bitmap->allocPixels(info);
+ bitmap->pixelRef()->setImmutable();
+ bitmap->pixelRef()->setURI(uri);
+}
+
+} // namespace cc
« no previous file with comments | « cc/test/skia_common.h ('k') | cc/test/test_context_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698