ClipCacheTest.cpp revision 80bacfeb4bda06541e8695bd502229727bccfea
180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* 280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2012 Google Inc. 380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * 480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be 580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file. 680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "Test.h" 1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// This is a GR test 1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if SK_SUPPORT_GPU 1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkGpuDevice.h" 1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "../../src/gpu/GrClipMaskManager.h" 1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic const int X_SIZE = 12; 1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic const int Y_SIZE = 12; 1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//////////////////////////////////////////////////////////////////////////////// 1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// note: this is unused 2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic GrTexture* createTexture(GrContext* context) { 2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru unsigned char textureData[X_SIZE][Y_SIZE][4]; 2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru memset(textureData, 0, 4* X_SIZE * Y_SIZE); 2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrTextureDesc desc; 2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // let Skia know we will be using this texture as a render target 2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru desc.fFlags = kRenderTarget_GrTextureFlagBit; 2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru desc.fConfig = kSkia8888_PM_GrPixelConfig; 3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru desc.fWidth = X_SIZE; 3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru desc.fHeight = Y_SIZE; 3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // We are initializing the texture with zeros here 3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrTexture* texture = context->createUncachedTexture(desc, textureData, 0); 3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (!texture) { 3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return NULL; 3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return texture; 4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// Ensure that the 'getConservativeBounds' calls are returning bounds clamped 4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// to the render target 4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic void test_clip_bounds(skiatest::Reporter* reporter, GrContext* context) { 4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static const int kXSize = 100; 4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru static const int kYSize = 100; 4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrTextureDesc desc; 5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru desc.fFlags = kRenderTarget_GrTextureFlagBit; 5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru desc.fConfig = kAlpha_8_GrPixelConfig; 5280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru desc.fWidth = kXSize; 5380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru desc.fHeight = kYSize; 5480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 5580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrTexture* texture = context->createUncachedTexture(desc, NULL, 0); 5680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (!texture) { 5780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return; 5880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 5980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 6080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrAutoUnref au(texture); 6180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 6280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkIRect intScreen = SkIRect::MakeWH(kXSize, kYSize); 6380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkRect screen = SkRect::MakeWH(SkIntToScalar(kXSize), 6480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkIntToScalar(kYSize)); 6580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkRect clipRect(screen); 6680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru clipRect.outset(10, 10); 6780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 6880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // create a clip stack that will (trivially) reduce to a single rect that 6980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // is larger than the screen 7080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkClipStack stack; 7180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru stack.clipDevRect(clipRect, SkRegion::kReplace_Op, false); 7280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 7380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bool isIntersectionOfRects = true; 7480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkRect devStackBounds; 7580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 7680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru stack.getConservativeBounds(0, 0, kXSize, kYSize, 7780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru &devStackBounds, 7880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru &isIntersectionOfRects); 7980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 8080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // make sure that the SkClipStack is behaving itself 8180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, screen == devStackBounds); 8280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, isIntersectionOfRects); 8380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 8480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // wrap the SkClipStack in a GrClipData 8580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrClipData clipData; 8680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru clipData.fClipStack = &stack; 8780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 8880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkIRect devGrClipDataBound; 8980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru clipData.getConservativeBounds(texture, 9080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru &devGrClipDataBound, 9180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru &isIntersectionOfRects); 9280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 9380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // make sure that GrClipData is behaving itself 9480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, intScreen == devGrClipDataBound); 9580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, isIntersectionOfRects); 9680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 9780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 9880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//////////////////////////////////////////////////////////////////////////////// 9980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// verify that the top state of the stack matches the passed in state 10080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic void check_state(skiatest::Reporter* reporter, 10180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru const GrClipMaskCache& cache, 10280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru const SkClipStack& clip, 10380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrTexture* mask, 10480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru const GrIRect& bound) { 10580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkClipStack cacheClip; 10680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru cache.getLastClip(&cacheClip); 10780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, clip == cacheClip); 10880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 10980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, mask == cache.getLastMask()); 11080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 11180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrIRect cacheBound; 11280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru cache.getLastBound(&cacheBound); 11380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, bound == cacheBound); 11480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 11580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 11680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//////////////////////////////////////////////////////////////////////////////// 11780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// basic test of the cache's base functionality: 11880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// push, pop, set, canReuse & getters 11980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic void test_cache(skiatest::Reporter* reporter, GrContext* context) { 12080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 12180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (false) { // avoid bit rot, suppress warning 12280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru createTexture(context); 12380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 12480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrClipMaskCache cache; 12580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 12680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru cache.setContext(context); 12780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 12880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkClipStack emptyClip; 12980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru emptyClip.reset(); 13080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 13180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrIRect emptyBound; 13280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru emptyBound.setEmpty(); 13380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 13480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // check initial state 13580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru check_state(reporter, cache, emptyClip, NULL, emptyBound); 13680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 13780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // set the current state 13880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrIRect bound1; 13980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bound1.set(0, 0, 100, 100); 14080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 14180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkClipStack clip1(bound1); 14280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 14380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrTextureDesc desc; 14480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru desc.fFlags = kRenderTarget_GrTextureFlagBit; 14580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru desc.fWidth = X_SIZE; 14680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru desc.fHeight = Y_SIZE; 14780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru desc.fConfig = kSkia8888_PM_GrPixelConfig; 14880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 14980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru cache.acquireMask(clip1, desc, bound1); 15080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 15180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrTexture* texture1 = cache.getLastMask(); 15280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, texture1); 15380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (NULL == texture1) { 15480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return; 15580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 15680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 15780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // check that the set took 15880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru check_state(reporter, cache, clip1, texture1, bound1); 15980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, 1 == texture1->getRefCnt()); 16080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 16180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // push the state 16280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru cache.push(); 16380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 16480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // verify that the pushed state is initially empty 16580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru check_state(reporter, cache, emptyClip, NULL, emptyBound); 16680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, 1 == texture1->getRefCnt()); 16780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 16880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // modify the new state 16980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrIRect bound2; 17080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru bound2.set(-10, -10, 10, 10); 17180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 17280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkClipStack clip2(bound2); 17380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 17480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru cache.acquireMask(clip2, desc, bound2); 17580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 17680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrTexture* texture2 = cache.getLastMask(); 17780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, texture2); 17880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru if (NULL == texture2) { 17980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru return; 18080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru } 18180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 18280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // check that the changes took 18380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru check_state(reporter, cache, clip2, texture2, bound2); 18480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, 1 == texture1->getRefCnt()); 18580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, 1 == texture2->getRefCnt()); 18680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 18780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // check to make sure canReuse works 18880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, cache.canReuse(clip2, bound2)); 18980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, !cache.canReuse(clip1, bound1)); 19080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 19180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // pop the state 19280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru cache.pop(); 19380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 19480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // verify that the old state is restored 19580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru check_state(reporter, cache, clip1, texture1, bound1); 19680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, 1 == texture1->getRefCnt()); 19780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, 1 == texture2->getRefCnt()); 19880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 19980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // manually clear the state 20080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru cache.reset(); 20180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 20280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // verify it is now empty 20380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru check_state(reporter, cache, emptyClip, NULL, emptyBound); 20480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, 1 == texture1->getRefCnt()); 20580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, 1 == texture2->getRefCnt()); 20680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 20780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // pop again - so there is no state 20880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru cache.pop(); 20980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 21080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if !defined(SK_DEBUG) 21180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // verify that the getters don't crash 21280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru // only do in release since it generates asserts in debug 21380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru check_state(reporter, cache, emptyClip, NULL, emptyBound); 21480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 21580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, 1 == texture1->getRefCnt()); 21680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru REPORTER_ASSERT(reporter, 1 == texture2->getRefCnt()); 21780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 21880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 21980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//////////////////////////////////////////////////////////////////////////////// 22080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querustatic void TestClipCache(skiatest::Reporter* reporter, GrContext* context) { 22180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 22280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru test_cache(reporter, context); 22380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru test_clip_bounds(reporter, context); 22480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru} 22580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 22680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru//////////////////////////////////////////////////////////////////////////////// 22780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "TestClassDef.h" 22880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruDEFINE_GPUTESTCLASS("ClipCache", ClipCacheTestClass, TestClipCache) 22980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 23080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 231