| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrCaps.h" | 8 #include "GrCaps.h" |
| 9 #include "GrContextFactory.h" | 9 #include "GrContextFactory.h" |
| 10 #include "Benchmark.h" | 10 #include "Benchmark.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 GrContextFactory::GLContextType ctxType, | 175 GrContextFactory::GLContextType ctxType, |
| 176 GrContextFactory::GLContextOptions ctxOptions, int numSamples) { | 176 GrContextFactory::GLContextOptions ctxOptions, int numSamples) { |
| 177 GrContext* context = factory->get(ctxType, ctxOptions); | 177 GrContext* context = factory->get(ctxType, ctxOptions); |
| 178 int maxRTSize = context->caps()->maxRenderTargetSize(); | 178 int maxRTSize = context->caps()->maxRenderTargetSize(); |
| 179 SkImageInfo info = SkImageInfo::Make(SkTMin(bench->getSize().fX, maxRTSi
ze), | 179 SkImageInfo info = SkImageInfo::Make(SkTMin(bench->getSize().fX, maxRTSi
ze), |
| 180 SkTMin(bench->getSize().fY, maxRTSi
ze), | 180 SkTMin(bench->getSize().fY, maxRTSi
ze), |
| 181 kN32_SkColorType, kPremul_SkAlphaT
ype); | 181 kN32_SkColorType, kPremul_SkAlphaT
ype); |
| 182 uint32_t flags = useDfText ? SkSurfaceProps::kUseDeviceIndependentFonts_
Flag : | 182 uint32_t flags = useDfText ? SkSurfaceProps::kUseDeviceIndependentFonts_
Flag : |
| 183 0; | 183 0; |
| 184 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); | 184 SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); |
| 185 fSurface.reset(SkSurface::NewRenderTarget(context, | 185 fSurface.reset(SkSurface::MakeRenderTarget(context, |
| 186 SkBudgeted::kNo, info, | 186 SkBudgeted::kNo, info, |
| 187 numSamples, &props)); | 187 numSamples, &props).release()
); |
| 188 fGL = factory->getContextInfo(ctxType, ctxOptions).fGLContext; | 188 fGL = factory->getContextInfo(ctxType, ctxOptions).fGLContext; |
| 189 if (!fSurface.get()) { | 189 if (!fSurface.get()) { |
| 190 return false; | 190 return false; |
| 191 } | 191 } |
| 192 | 192 |
| 193 // Kilobench should only be used on platforms with fence sync support | 193 // Kilobench should only be used on platforms with fence sync support |
| 194 SkASSERT(fGL->fenceSyncSupport()); | 194 SkASSERT(fGL->fenceSyncSupport()); |
| 195 return true; | 195 return true; |
| 196 } | 196 } |
| 197 | 197 |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 } | 645 } |
| 646 return 0; | 646 return 0; |
| 647 } | 647 } |
| 648 | 648 |
| 649 #if !defined SK_BUILD_FOR_IOS | 649 #if !defined SK_BUILD_FOR_IOS |
| 650 int main(int argc, char** argv) { | 650 int main(int argc, char** argv) { |
| 651 SkCommandLineFlags::Parse(argc, argv); | 651 SkCommandLineFlags::Parse(argc, argv); |
| 652 return kilobench_main(); | 652 return kilobench_main(); |
| 653 } | 653 } |
| 654 #endif | 654 #endif |
| OLD | NEW |