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

Unified Diff: src/gpu/GrSurface.cpp

Issue 648863002: Devirtualize read/write pixels on surface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: simplify return Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrRenderTarget.cpp ('k') | src/gpu/GrTexture.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrSurface.cpp
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index d067f07d0df167512e1259106d52dac4a4bc53b7..0aa5f681ab2d1a07657e9814b77ff20b039d9766 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -13,6 +13,34 @@
#include "SkImageEncoder.h"
#include <stdio.h>
+bool GrSurface::writePixels(int left, int top, int width, int height,
+ GrPixelConfig config, const void* buffer, size_t rowBytes,
+ uint32_t pixelOpsFlags) {
+ // go through context so that all necessary flushing occurs
+ GrContext* context = this->getContext();
+ if (NULL == context) {
+ return false;
+ }
+ return context->writeSurfacePixels(this, left, top, width, height, config, buffer, rowBytes,
+ pixelOpsFlags);
+}
+
+bool GrSurface::readPixels(int left, int top, int width, int height,
+ GrPixelConfig config, void* buffer, size_t rowBytes,
+ uint32_t pixelOpsFlags) {
+ // go through context so that all necessary flushing occurs
+ GrContext* context = this->getContext();
+ if (NULL == context) {
+ return false;
+ }
+ GrRenderTarget* target = this->asRenderTarget();
+ if (target) {
+ return context->readRenderTargetPixels(target, left, top, width, height, config, buffer,
+ rowBytes, pixelOpsFlags);
+ }
+ return false;
+}
+
SkImageInfo GrSurface::info() const {
SkColorType colorType;
if (!GrPixelConfig2ColorType(this->config(), &colorType)) {
« no previous file with comments | « src/gpu/GrRenderTarget.cpp ('k') | src/gpu/GrTexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698