desc.fFlags = kRenderTarget_GrTextureFlagBit;
desc.fWidth = width;
desc.fHeight = height;
- desc.fSampleCnt = 0;
+ desc.fSampleCnt = fSampleCount;
target.reset(fGrContext->createUncachedTexture(desc, NULL, 0));
}
if (NULL == target.get()) {
#endif
}
+#if SK_SUPPORT_GPU
+ void setSampleCount(int sampleCount) {
+ fSampleCount = sampleCount;
+ }
+#endif
+
void setDrawFilters(DrawFilterFlags const * const filters, const SkString& configName) {
memcpy(fDrawFilters, filters, sizeof(fDrawFilters));
fDrawFiltersConfig = configName;
#if SK_SUPPORT_GPU
switch (fDeviceType) {
case kGPU_DeviceType:
- config.append("_gpu");
+ if (fSampleCount) {
+ config.appendf("_msaa%d", fSampleCount);
+ } else {
+ config.append("_gpu");
+ }
break;
#if SK_ANGLE
case kAngle_DeviceType:
, fScaleFactor(SK_Scalar1)
#if SK_SUPPORT_GPU
, fGrContext(NULL)
+ , fSampleCount(0)
#endif
{
fGridInfo.fMargin.setEmpty();
#if SK_SUPPORT_GPU
GrContextFactory fGrContextFactory;
GrContext* fGrContext;
+ int fSampleCount;
#endif
virtual SkString getConfigNameInternal() = 0;
// consistent.
#if SK_ANGLE
// ANGLE assumes GPU
-DEFINE_string(config, "8888", "[8888|gpu|angle]: Use the corresponding config.");
+DEFINE_string(config, "8888", "[8888|gpu|msaa4|msaa16|angle]: Use the corresponding config.");
#elif SK_SUPPORT_GPU
-DEFINE_string(config, "8888", "[8888|gpu]: Use the corresponding config.");
+DEFINE_string(config, "8888", "[8888|gpu|msaa4|msaa16]: Use the corresponding config.");
#else
DEFINE_string(config, "8888", "[8888]: Use the corresponding config.");
#endif
sk_tools::PictureRenderer::SkDeviceTypes deviceType =
sk_tools::PictureRenderer::kBitmap_DeviceType;
+#if SK_SUPPORT_GPU
+ int sampleCount = 0;
+#endif
if (FLAGS_config.count() > 0) {
if (0 == strcmp(FLAGS_config[0], "8888")) {
deviceType = sk_tools::PictureRenderer::kBitmap_DeviceType;
return NULL;
}
}
+ else if (0 == strcmp(FLAGS_config[0], "msaa4")) {
+ deviceType = sk_tools::PictureRenderer::kGPU_DeviceType;
+ if (FLAGS_multi > 1) {
+ error.printf("GPU not compatible with multithreaded tiling.\n");
+ return NULL;
+ }
+ sampleCount = 4;
+ }
+ else if (0 == strcmp(FLAGS_config[0], "msaa16")) {
+ deviceType = sk_tools::PictureRenderer::kGPU_DeviceType;
+ if (FLAGS_multi > 1) {
+ error.printf("GPU not compatible with multithreaded tiling.\n");
+ return NULL;
+ }
+ sampleCount = 16;
+ }
#if SK_ANGLE
else if (0 == strcmp(FLAGS_config[0], "angle")) {
deviceType = sk_tools::PictureRenderer::kAngle_DeviceType;
return NULL;
}
renderer->setDeviceType(deviceType);
+#if SK_SUPPORT_GPU
+ renderer->setSampleCount(sampleCount);
+#endif
}