aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrSurface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrSurface.cpp')
-rw-r--r--src/gpu/GrSurface.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index fed95f232f..1fcc4ff18b 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -8,9 +8,19 @@
#include "GrSurface.h"
#include "SkBitmap.h"
+#include "SkGr.h"
#include "SkImageEncoder.h"
#include <stdio.h>
+void GrSurface::asImageInfo(SkImageInfo* info) const {
+ if (!GrPixelConfig2ColorType(this->config(), &info->fColorType)) {
+ sk_throw();
+ }
+ info->fWidth = this->width();
+ info->fHeight = this->height();
+ info->fAlphaType = kPremul_SkAlphaType;
+}
+
bool GrSurface::savePixels(const char* filename) {
SkBitmap bm;
bm.setConfig(SkBitmap::kARGB_8888_Config, this->width(), this->height());