}
void SkDrawImageCommand::execute(SkCanvas* canvas) const {
- canvas->drawImage(fImage, fLeft, fTop, fPaint.getMaybeNull());
+ canvas->drawImage(fImage.get(), fLeft, fTop, fPaint.getMaybeNull());
}
bool SkDrawImageCommand::render(SkCanvas* canvas) const {
}
void SkDrawImageRectCommand::execute(SkCanvas* canvas) const {
- canvas->legacy_drawImageRect(fImage, fSrc.getMaybeNull(), fDst, fPaint.getMaybeNull(),
- fConstraint);
+ canvas->legacy_drawImageRect(fImage.get(), fSrc.getMaybeNull(), fDst,
+ fPaint.getMaybeNull(), fConstraint);
}
bool SkDrawImageRectCommand::render(SkCanvas* canvas) const {
static SkDrawImageCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
private:
- SkAutoTUnref<const SkImage> fImage;
- SkScalar fLeft;
- SkScalar fTop;
- SkTLazy<SkPaint> fPaint;
+ sk_sp<const SkImage> fImage;
+ SkScalar fLeft;
+ SkScalar fTop;
+ SkTLazy<SkPaint> fPaint;
typedef SkDrawCommand INHERITED;
};
static SkDrawImageRectCommand* fromJSON(Json::Value& command, UrlDataManager& urlDataManager);
private:
- SkAutoTUnref<const SkImage> fImage;
+ sk_sp<const SkImage> fImage;
SkTLazy<SkRect> fSrc;
SkRect fDst;
SkTLazy<SkPaint> fPaint;
bool render(SkCanvas* canvas) const override;
private:
- SkAutoTUnref<const SkPicture> fPicture;
- SkTLazy<SkMatrix> fMatrix;
- SkTLazy<SkPaint> fPaint;
+ sk_sp<const SkPicture> fPicture;
+ SkTLazy<SkMatrix> fMatrix;
+ SkTLazy<SkPaint> fPaint;
typedef SkDrawCommand INHERITED;
};
bool render(SkCanvas* canvas) const override;
private:
- SkAutoTUnref<const SkPicture> fPicture;
+ sk_sp<const SkPicture> fPicture;
SkTLazy<SkMatrix> fMatrix;
SkTLazy<SkPaint> fPaint;
#ifdef SK_EXPERIMENTAL_SHADOWING
GrResourceProvider* resourceProvider() { return fContext->resourceProvider(); }
private:
- SkAutoTUnref<GrContext> fContext;
- sk_sp<GrRenderTargetContext> fRenderTargetContext;
+ sk_sp<GrContext> fContext;
+ sk_sp<GrRenderTargetContext> fRenderTargetContext;
};
#endif
GrGLint GLTestContext::createTextureRectangle(int width, int height, GrGLenum internalFormat,
GrGLenum externalFormat, GrGLenum externalType,
GrGLvoid* data) {
- if (!(kGL_GrGLStandard == fGL->fStandard && GrGLGetVersion(fGL) >= GR_GL_VER(3, 1)) &&
+ if (!(kGL_GrGLStandard == fGL->fStandard && GrGLGetVersion(fGL.get()) >= GR_GL_VER(3, 1)) &&
!fGL->fExtensions.has("GL_ARB_texture_rectangle")) {
return 0;
}
- if (GrGLGetGLSLVersion(fGL) < GR_GLSL_VER(1, 40)) {
+ if (GrGLGetGLSLVersion(fGL.get()) < GR_GLSL_VER(1, 40)) {
return 0;
}
GrGLuint id;
- GR_GL_CALL(fGL, GenTextures(1, &id));
- GR_GL_CALL(fGL, BindTexture(GR_GL_TEXTURE_RECTANGLE, id));
- GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_MAG_FILTER,
- GR_GL_NEAREST));
- GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_MIN_FILTER,
- GR_GL_NEAREST));
- GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_S,
- GR_GL_CLAMP_TO_EDGE));
- GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_T,
- GR_GL_CLAMP_TO_EDGE));
- GR_GL_CALL(fGL, TexImage2D(GR_GL_TEXTURE_RECTANGLE, 0, internalFormat, width, height, 0,
- externalFormat, externalType, data));
+ GR_GL_CALL(fGL.get(), GenTextures(1, &id));
+ GR_GL_CALL(fGL.get(), BindTexture(GR_GL_TEXTURE_RECTANGLE, id));
+ GR_GL_CALL(fGL.get(), TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_MAG_FILTER,
+ GR_GL_NEAREST));
+ GR_GL_CALL(fGL.get(), TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_MIN_FILTER,
+ GR_GL_NEAREST));
+ GR_GL_CALL(fGL.get(), TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_S,
+ GR_GL_CLAMP_TO_EDGE));
+ GR_GL_CALL(fGL.get(), TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_T,
+ GR_GL_CLAMP_TO_EDGE));
+ GR_GL_CALL(fGL.get(), TexImage2D(GR_GL_TEXTURE_RECTANGLE, 0, internalFormat, width, height, 0,
+ externalFormat, externalType, data));
return id;
}
} // namespace sk_gpu_test
private:
/** Subclass provides the gl interface object if construction was
* successful. */
- SkAutoTUnref<const GrGLInterface> fGL;
+ sk_sp<const GrGLInterface> fGL;
typedef TestContext INHERITED;
};
eglMakeCurrent(fDisplay, fSurface, fSurface, fContext);
- SkAutoTUnref<const GrGLInterface> gl(sk_gpu_test::CreateANGLEGLInterface());
+ sk_sp<const GrGLInterface> gl(sk_gpu_test::CreateANGLEGLInterface());
if (nullptr == gl.get()) {
SkDebugf("Could not create ANGLE GL interface!\n");
this->destroyGLContext();
return;
}
- SkAutoTUnref<const GrGLInterface> gl(create_command_buffer_interface());
+ sk_sp<const GrGLInterface> gl(create_command_buffer_interface());
if (nullptr == gl.get()) {
SkDebugf("Command Buffer: Could not create CommandBuffer GL interface.\n");
this->destroyGLContext();
}
SkASSERT(forcedGpuAPI == kNone_GrGLStandard || kAPIs[api].fStandard == forcedGpuAPI);
- SkAutoTUnref<const GrGLInterface> gl;
+ sk_sp<const GrGLInterface> gl;
for (; nullptr == gl.get() && api < apiLimit; ++api) {
fDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
return;
}
- SkAutoTUnref<const GrGLInterface> gl(GrGLCreateNativeInterface());
+ sk_sp<const GrGLInterface> gl(GrGLCreateNativeInterface());
if (nullptr == gl.get()) {
SkDebugf("Failed to create gl interface");
this->destroyGLContext();
fEAGLContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
[EAGLContext setCurrentContext:EAGLCTX];
- SkAutoTUnref<const GrGLInterface> gl(GrGLCreateNativeInterface());
+ sk_sp<const GrGLInterface> gl(GrGLCreateNativeInterface());
if (NULL == gl.get()) {
SkDebugf("Failed to create gl interface");
this->destroyGLContext();
CGLSetCurrentContext(fContext);
- SkAutoTUnref<const GrGLInterface> gl(GrGLCreateNativeInterface());
+ sk_sp<const GrGLInterface> gl(GrGLCreateNativeInterface());
if (nullptr == gl.get()) {
SkDebugf("Context could not create GL interface.\n");
this->destroyGLContext();
return;
}
- SkAutoTUnref<const GrGLInterface> gl(create_mesa_interface());
+ sk_sp<const GrGLInterface> gl(create_mesa_interface());
if (nullptr == gl.get()) {
SkDebugf("Could not create GL interface!\n");
this->destroyGLContext();
return;
}
- SkAutoTUnref<const GrGLInterface> gl(GrGLCreateNativeInterface());
+ sk_sp<const GrGLInterface> gl(GrGLCreateNativeInterface());
if (nullptr == gl.get()) {
SkDebugf("Could not create GL interface.\n");
this->destroyGLContext();
auto pic(load_picture(path));
if (pic.get()) {
- SkAutoTUnref<SkLuaCanvas> canvas(
+ sk_sp<SkLuaCanvas> canvas(
new SkLuaCanvas(SkScalarCeilToInt(pic->cullRect().width()),
SkScalarCeilToInt(pic->cullRect().height()),
L.get(), gAccumulateFunc));
name, style.weight(), style.width(), style.slant());
// If we called SkTypeface::CreateFromName() here we'd recurse infinitely,
// so we reimplement its core logic here inline without the recursive aspect.
- SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
+ sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault());
return sk_sp<SkTypeface>(fm->legacyCreateTypeface(name, style));
}
} else {
SkDynamicMemoryWStream outStream;
- SkAutoTUnref<SkPixelSerializer> serializer(SkImageEncoder::CreatePixelSerializer());
- picture->serialize(&outStream, serializer);
+ sk_sp<SkPixelSerializer> serializer(SkImageEncoder::CreatePixelSerializer());
+ picture->serialize(&outStream, serializer.get());
return outStream.detachAsData();
}
sk_sp<SkData> Request::getJsonInfo(int n) {
// drawTo
- SkAutoTUnref<SkSurface> surface(this->createCPUSurface());
+ sk_sp<SkSurface> surface(this->createCPUSurface());
SkCanvas* canvas = surface->getCanvas();
// TODO this is really slow and we should cache the matrix and clip
SkColor getPixel(int x, int y);
UploadContext* fUploadContext;
- SkAutoTUnref<SkDebugCanvas> fDebugCanvas;
+ sk_sp<SkDebugCanvas> fDebugCanvas;
UrlDataManager fUrlDataManager;
private:
sk_sp<SkPicture> fPicture;
sk_gpu_test::GrContextFactory* fContextFactory;
- SkAutoTUnref<SkSurface> fSurface;
+ sk_sp<SkSurface> fSurface;
bool fGPUEnabled;
bool fOverdraw;
int fColorMode;
return MHD_NO;
}
- SkAutoTUnref<UrlDataManager::UrlData> urlData(
+ sk_sp<UrlDataManager::UrlData> urlData(
SkRef(request->fUrlDataManager.getDataFromUrl(SkString(url))));
if (urlData) {
void GLWindowContext::initializeContext() {
this->onInitializeContext();
- SkAutoTUnref<const GrGLInterface> glInterface;
+ sk_sp<const GrGLInterface> glInterface;
glInterface.reset(GrGLCreateNativeInterface());
fBackendContext.reset(GrGLInterfaceRemoveNVPR(glInterface.get()));
desc.fSampleCnt = fSampleCount;
desc.fStencilBits = fStencilBits;
GrGLint buffer;
- GR_GL_CALL(fBackendContext, GetIntegerv(GR_GL_FRAMEBUFFER_BINDING, &buffer));
+ GR_GL_CALL(fBackendContext.get(), GetIntegerv(GR_GL_FRAMEBUFFER_BINDING, &buffer));
desc.fRenderTargetHandle = buffer;
fSurface = this->createRenderSurface(desc, fActualColorBits);
virtual void onSwapBuffers() = 0;
- SkAutoTUnref<const GrGLInterface> fBackendContext;
- sk_sp<SkSurface> fSurface;
+ sk_sp<const GrGLInterface> fBackendContext;
+ sk_sp<SkSurface> fSurface;
// parameters obtained from the native window
// Note that the platform .cpp file is responsible for
// initializing fSampleCount, fStencilBits, and fColorBits!
- int fSampleCount;
- int fStencilBits;
- int fColorBits;
- int fActualColorBits;
+ int fSampleCount;
+ int fStencilBits;
+ int fColorBits;
+ int fActualColorBits;
};
} // namespace sk_app
void createBuffers(VkFormat format);
void destroyBuffers();
- SkAutoTUnref<const GrVkBackendContext> fBackendContext;
+ sk_sp<const GrVkBackendContext> fBackendContext;
// simple wrapper class that exists only to initialize a pointer to NULL
template <typename FNPTR_TYPE> class VkPtr {