SkImageFilter* input = NULL);
#if SK_SUPPORT_GPU
- /**
- * Wrap the given texture in a texture-backed SkBitmap.
- */
- static void WrapTexture(GrTexture* texture, int width, int height, SkBitmap* result);
-
// Helper function which invokes GPU filter processing on the
// input at the specified "index". If the input is null, it leaves
// "result" and "offset" untouched, and returns true. If the input
if (drawContext) {
drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
- WrapTexture(dst, bounds.width(), bounds.height(), result);
+ GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result);
return true;
}
}
#if SK_SUPPORT_GPU
-void SkImageFilter::WrapTexture(GrTexture* texture, int width, int height, SkBitmap* result) {
- SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
- result->setInfo(info);
- result->setPixelRef(new SkGrPixelRef(info, texture))->unref();
-}
-
bool SkImageFilter::filterInputGPU(int index, SkImageFilter::Proxy* proxy,
const SkBitmap& src, const Context& ctx,
SkBitmap* result, SkIPoint* offset) const {
#if SK_SUPPORT_GPU
#include "GrTexture.h"
#include "SkGr.h"
-#include "SkGrPixelRef.h"
#endif
SkMaskFilter::NinePatch::~NinePatch() {
#include "SkWriteBuffer.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
+#include "SkGr.h"
#endif
// This rather arbitrary-looking value results in a maximum box blur kernel size
if (!tex) {
return false;
}
- WrapTexture(tex, dstBounds.width(), dstBounds.height(), result);
+ GrWrapTextureInBitmap(tex, dstBounds.width(), dstBounds.height(), false, result);
return true;
#else
SkDEBUGFAIL("Should not call in GPU-less build");
#include "GrTexture.h"
#include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h"
-#include "SkGrPixelRef.h"
#include "SkDraw.h"
#include "effects/GrSimpleTextureEffect.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "GrDrawContext.h"
#include "GrCoordTransform.h"
#include "GrInvariantOutput.h"
+#include "SkGr.h"
#include "effects/GrTextureDomain.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(colorBounds));
offset->fX = bounds.left();
offset->fY = bounds.top();
- WrapTexture(dst, bounds.width(), bounds.height(), result);
+ GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result);
return true;
}
#include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h"
#include "GrPaint.h"
+#include "SkGr.h"
#include "effects/GrSingleTextureEffect.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
this->drawRect(drawContext, srcTexture, matrix, clip, bottom, kBottom_BoundaryMode, bounds);
this->drawRect(drawContext, srcTexture, matrix, clip, bottomRight,
kBottomRight_BoundaryMode, bounds);
- WrapTexture(dst, bounds.width(), bounds.height(), result);
+ GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result);
return true;
}
#endif
#include "GrDrawContext.h"
#include "GrInvariantOutput.h"
#include "GrTexture.h"
+#include "SkGr.h"
#include "effects/Gr1DKernelEffect.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
srcTexture.reset(scratch);
}
- SkImageFilter::WrapTexture(srcTexture, rect.width(), rect.height(), dst);
+ GrWrapTextureInBitmap(srcTexture, rect.width(), rect.height(), false, dst);
return true;
}
offset->fX = bounds.left();
offset->fY = bounds.top();
- WrapTexture(dst, bounds.width(), bounds.height(), result);
+ GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result);
return true;
}
#include "SkBigPicture.h"
#include "SkCanvas.h"
#include "SkGpuDevice.h"
-#include "SkGrPixelRef.h"
#include "SkLayerInfo.h"
#include "SkRecordDraw.h"
#include "SkSurface.h"
}
}
-SkBitmap wrap_texture(GrTexture* texture) {
- SkASSERT(texture);
-
- SkBitmap result;
- result.setInfo(texture->surfacePriv().info(kPremul_SkAlphaType));
- result.setPixelRef(new SkGrPixelRef(result.info(), texture))->unref();
- return result;
-}
-
void GrLayerHoister::FilterLayer(GrContext* context,
SkGpuDevice* device,
const GrHoistedLayer& info) {
SkImageFilter::Context filterContext(totMat, clipBounds, cache);
SkImageFilter::DeviceProxy proxy(device);
- const SkBitmap src = wrap_texture(layer->texture());
+ SkBitmap src;
+ GrWrapTextureInBitmap(layer->texture(), layer->texture()->width(), layer->texture()->height(),
+ false, &src);
if (!layer->filter()->filterImage(&proxy, src, filterContext, &filteredBitmap, &offset)) {
// Filtering failed. Press on with the unfiltered version.
#include "GrRecordReplaceDraw.h"
#include "SkBigPicture.h"
#include "SkCanvasPriv.h"
-#include "SkGrPixelRef.h"
+#include "SkGr.h"
#include "SkImage.h"
#include "SkRecordDraw.h"
#include "SkRecords.h"
-static inline void wrap_texture(GrTexture* texture, int width, int height, SkBitmap* result) {
- SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
- result->setInfo(info);
- result->setPixelRef(new SkGrPixelRef(info, texture))->unref();
-}
static inline void draw_replacement_bitmap(GrCachedLayer* layer, SkCanvas* canvas) {
}
SkBitmap bm;
- wrap_texture(layer->texture(),
- !layer->isAtlased() ? layer->rect().width() : layer->texture()->width(),
- !layer->isAtlased() ? layer->rect().height() : layer->texture()->height(),
- &bm);
+ GrWrapTextureInBitmap(layer->texture(),
+ !layer->isAtlased() ? layer->rect().width() : layer->texture()->width(),
+ !layer->isAtlased() ? layer->rect().height() : layer->texture()->height(),
+ false,
+ &bm);
canvas->save();
canvas->setMatrix(SkMatrix::I());
///////////////////////////////////////////////////////////////////////////////
-static SkBitmap wrap_texture(GrTexture* texture, int width, int height) {
- SkBitmap result;
- result.setInfo(SkImageInfo::MakeN32Premul(width, height));
- result.setPixelRef(new SkGrPixelRef(result.info(), texture))->unref();
- return result;
-}
-
void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
const SkPaint& paint, const SkMatrix* prePathMatrix,
bool pathIsMutable) {
SkImageFilter::DeviceProxy proxy(this);
if (filter->canFilterImageGPU()) {
- return filter->filterImageGPU(&proxy, wrap_texture(texture, width, height),
- ctx, result, offset);
+ SkBitmap bm;
+ GrWrapTextureInBitmap(texture, width, height, false, &bm);
+ return filter->filterImageGPU(&proxy, bm, ctx, result, offset);
} else {
return false;
}