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

Unified Diff: gm/peekpixels.cpp

Issue 1550583002: remove unused SkAutoROCanvasPixels (Closed) Base URL: https://skia.googlesource.com/skia.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 | « no previous file | gm/xfermodes3.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/peekpixels.cpp
diff --git a/gm/peekpixels.cpp b/gm/peekpixels.cpp
deleted file mode 100644
index a443c41b89c2b7675197935242f43fc2ee50cf87..0000000000000000000000000000000000000000
--- a/gm/peekpixels.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "gm.h"
-#include "SkCanvas.h"
-#include "SkPath.h"
-#include "SkSurface.h"
-#include "SkPicture.h"
-
-static void draw_content(SkCanvas* canvas) {
- SkImageInfo info = canvas->imageInfo();
- SkPaint paint;
- paint.setAntiAlias(true);
- canvas->drawCircle(SkScalarHalf(info.width()), SkScalarHalf(info.height()),
- SkScalarHalf(info.width()), paint);
-}
-
-class PeekPixelsGM : public skiagm::GM {
-public:
- PeekPixelsGM() {}
-
-protected:
- SkString onShortName() override {
- return SkString("peekpixels");
- }
-
- SkISize onISize() override {
- return SkISize::Make(360, 120);
- }
-
- void onDraw(SkCanvas* canvas) override {
- SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
- SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
- if (surface.get()) {
- SkCanvas* surfCanvas = surface->getCanvas();
-
- draw_content(surfCanvas);
- SkBitmap bitmap;
-
- // test peekPixels
- {
- SkImageInfo info;
- size_t rowBytes;
- const void* addr = surfCanvas->peekPixels(&info, &rowBytes);
- if (addr && bitmap.installPixels(info, const_cast<void*>(addr), rowBytes)) {
- canvas->drawBitmap(bitmap, 0, 0, nullptr);
- }
- }
-
- // test ROCanvasPixels
- canvas->translate(120, 0);
- SkAutoROCanvasPixels ropixels(surfCanvas);
- if (ropixels.asROBitmap(&bitmap)) {
- canvas->drawBitmap(bitmap, 0, 0, nullptr);
- }
-
- // test Surface
- canvas->translate(120, 0);
- surface->draw(canvas, 0, 0, nullptr);
- }
- }
-
-private:
- typedef skiagm::GM INHERITED;
-};
-
-DEF_GM(return new PeekPixelsGM;)
« no previous file with comments | « no previous file | gm/xfermodes3.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698