| Index: src/gpu/GrDrawContext.cpp
|
| diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
|
| index 2bb9caa8b170d994862b5e0e51965fe9159023b2..e76683033cbb5fd2e9cbf6fe802cbca7864687c0 100644
|
| --- a/src/gpu/GrDrawContext.cpp
|
| +++ b/src/gpu/GrDrawContext.cpp
|
| @@ -37,6 +37,7 @@
|
|
|
| #include "../private/GrAuditTrail.h"
|
|
|
| +#include "SkGr.h"
|
| #include "SkLatticeIter.h"
|
| #include "SkMatrixPriv.h"
|
|
|
| @@ -1125,6 +1126,39 @@ void GrDrawContext::drawNonAAFilledRect(const GrClip& clip,
|
| this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch);
|
| }
|
|
|
| +bool GrDrawContext::readPixels(const SkImageInfo& dstInfo, void* dstBuffer, size_t dstRowBytes,
|
| + int x, int y) {
|
| + // TODO: teach fRenderTarget to take ImageInfo directly to specify the src pixels
|
| + GrPixelConfig config = SkImageInfo2GrPixelConfig(dstInfo, *fContext->caps());
|
| + if (kUnknown_GrPixelConfig == config) {
|
| + return false;
|
| + }
|
| +
|
| + uint32_t flags = 0;
|
| + if (kUnpremul_SkAlphaType == dstInfo.alphaType()) {
|
| + flags = GrContext::kUnpremul_PixelOpsFlag;
|
| + }
|
| +
|
| + return fRenderTarget->readPixels(x, y, dstInfo.width(), dstInfo.height(),
|
| + config, dstBuffer, dstRowBytes, flags);
|
| +}
|
| +
|
| +bool GrDrawContext::writePixels(const SkImageInfo& srcInfo, const void* srcBuffer,
|
| + size_t srcRowBytes, int x, int y) {
|
| + // TODO: teach fRenderTarget to take ImageInfo directly to specify the src pixels
|
| + GrPixelConfig config = SkImageInfo2GrPixelConfig(srcInfo, *fContext->caps());
|
| + if (kUnknown_GrPixelConfig == config) {
|
| + return false;
|
| + }
|
| + uint32_t flags = 0;
|
| + if (kUnpremul_SkAlphaType == srcInfo.alphaType()) {
|
| + flags = GrContext::kUnpremul_PixelOpsFlag;
|
| + }
|
| +
|
| + return fRenderTarget->writePixels(x, y, srcInfo.width(), srcInfo.height(),
|
| + config, srcBuffer, srcRowBytes, flags);
|
| +}
|
| +
|
| // Can 'path' be drawn as a pair of filled nested rectangles?
|
| static bool fills_as_nested_rects(const SkMatrix& viewMatrix, const SkPath& path, SkRect rects[2]) {
|
|
|
|
|