Commit 1dc2db8c authored by Brian Osman's avatar Brian Osman Committed by Commit Bot

Use GrMockContext (rather than NullGL interface) in blink unit tests

Skia's NullGL interface is deprecated, and this is the last piece of
code to use it. The Mock context is actually maintained (and simpler),
but is functionally a different backend.

With https://skia-review.googlesource.com/c/skia/+/204221, it supports
exporting textures as "GL", enough to allow CanvasResourceProvider to
work properly in tests. That, plus adding BGRA support (done here) gets
everything passing.

Change-Id: Id39101ed45f72e2294af9093e4610699936528ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1542239Reviewed-by: default avatarBrian Salomon <bsalomon@google.com>
Reviewed-by: default avatarFlorin Malita <fmalita@chromium.org>
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646299}
parent 5b03f6fb
......@@ -14,7 +14,7 @@
#include "third_party/blink/public/platform/web_graphics_context_3d_provider.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/gpu/GrContext.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
#include "third_party/skia/include/gpu/mock/GrMockTypes.h"
namespace blink {
......@@ -24,8 +24,10 @@ class FakeWebGraphicsContext3DProvider : public WebGraphicsContext3DProvider {
cc::ImageDecodeCache* cache = nullptr)
: gl_(gl),
image_decode_cache_(cache ? cache : &stub_image_decode_cache_) {
sk_sp<const GrGLInterface> gl_interface(GrGLCreateNullInterface());
gr_context_ = GrContext::MakeGL(std::move(gl_interface));
GrMockOptions mockOptions;
mockOptions.fConfigOptions[kBGRA_8888_GrPixelConfig] =
mockOptions.fConfigOptions[kRGBA_8888_GrPixelConfig];
gr_context_ = GrContext::MakeMock(&mockOptions);
// enable all gpu features.
for (unsigned feature = 0; feature < gpu::NUMBER_OF_GPU_FEATURE_TYPES;
++feature) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment