diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-11-08 18:45:27 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-11-08 18:45:27 +0000 |
commit | 9901727f213e459901a175c119b2fad8816002a0 (patch) | |
tree | 31df3eff9d666db749a174232d6f5a049b0abf23 | |
parent | c4a4f9db6ba448c27b2c99ee1b1cbea005596044 (diff) |
Fix stale assert in GrDrawTarget::print
Fix stale assert in GrDrawTarget::print.
R=bsalomon@google.com
Author: kkinnunen@nvidia.com
Review URL: https://codereview.chromium.org/66333002
git-svn-id: http://skia.googlecode.com/svn/trunk@12201 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | gyp/tests.gyp | 1 | ||||
-rw-r--r-- | src/gpu/GrDrawTarget.cpp | 3 | ||||
-rw-r--r-- | tests/GrDrawTargetTest.cpp | 38 |
3 files changed, 41 insertions, 1 deletions
diff --git a/gyp/tests.gyp b/gyp/tests.gyp index c5107acbd8..2462c819eb 100644 --- a/gyp/tests.gyp +++ b/gyp/tests.gyp @@ -74,6 +74,7 @@ '../tests/GpuColorFilterTest.cpp', '../tests/GpuDrawPathTest.cpp', '../tests/GrContextFactoryTest.cpp', + '../tests/GrDrawTargetTest.cpp', '../tests/GradientTest.cpp', '../tests/GrMemoryPoolTest.cpp', '../tests/GrSurfaceTest.cpp', diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index 9f35065afa..9397d1488f 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -1044,7 +1044,8 @@ void GrDrawTargetCaps::print() const { GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig); GR_STATIC_ASSERT(SK_ARRAY_COUNT(kConfigNames) == kGrPixelConfigCnt); - SkASSERT(!fConfigRenderSupport[kUnknown_GrPixelConfig]); + SkASSERT(!fConfigRenderSupport[kUnknown_GrPixelConfig][0]); + SkASSERT(!fConfigRenderSupport[kUnknown_GrPixelConfig][1]); for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { if (i != kUnknown_GrPixelConfig) { GrPrintf("%s is renderable: %s, with MSAA: %s\n", diff --git a/tests/GrDrawTargetTest.cpp b/tests/GrDrawTargetTest.cpp new file mode 100644 index 0000000000..a82524e88c --- /dev/null +++ b/tests/GrDrawTargetTest.cpp @@ -0,0 +1,38 @@ + +/* + * Copyright 2013 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#if SK_SUPPORT_GPU + +#include "GrContext.h" +#include "GrContextFactory.h" +#include "GrGpu.h" +#include "GrDrawTargetCaps.h" +#include "Test.h" + +static void test_print(skiatest::Reporter*, const GrDrawTargetCaps* caps) { + // This used to assert. + caps->print(); +} + +static void TestGrDrawTarget(skiatest::Reporter* reporter, GrContextFactory* factory) { + for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { + GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type); + + GrContext* grContext = factory->get(glType); + if (NULL == grContext) { + continue; + } + + test_print(reporter, grContext->getGpu()->caps()); + } +} + +#include "TestClassDef.h" +DEFINE_GPUTESTCLASS("GrDrawTarget", TestGrDrawTargetClass, TestGrDrawTarget) + +#endif |