Skip to content

Commit

Permalink
Remove duplicate CanvasColorParams in CanvasResourceGpuMemoryBuffer
Browse files Browse the repository at this point in the history
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I773e98e6906c6c1f5a9add6274e3891510d8b9a5
Reviewed-on: https://chromium-review.googlesource.com/1087353
Commit-Queue: Justin Novosad <junov@chromium.org>
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564640}
  • Loading branch information
junov authored and Commit Bot committed Jun 5, 2018
1 parent 7b3e3e4 commit 25d3c98
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
16 changes: 7 additions & 9 deletions third_party/blink/renderer/platform/graphics/canvas_resource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ CanvasResourceGpuMemoryBuffer::CanvasResourceGpuMemoryBuffer(
bool is_accelerated)
: CanvasResource(provider, filter_quality, color_params),
context_provider_wrapper_(std::move(context_provider_wrapper)),
color_params_(color_params),
is_accelerated_(is_accelerated) {
if (!context_provider_wrapper_)
return;
Expand All @@ -305,8 +304,7 @@ CanvasResourceGpuMemoryBuffer::CanvasResourceGpuMemoryBuffer(
if (!gpu_memory_buffer_manager)
return;
gpu_memory_buffer_ = gpu_memory_buffer_manager->CreateGpuMemoryBuffer(
gfx::Size(size.Width(), size.Height()),
color_params_.GetBufferFormat(), // Use format
gfx::Size(size.Width(), size.Height()), ColorParams().GetBufferFormat(),
buffer_usage, gpu::kNullSurfaceHandle);
if (!gpu_memory_buffer_) {
return;
Expand All @@ -315,7 +313,7 @@ CanvasResourceGpuMemoryBuffer::CanvasResourceGpuMemoryBuffer(

image_id_ = gl->CreateImageCHROMIUM(gpu_memory_buffer_->AsClientBuffer(),
size.Width(), size.Height(),
color_params_.GLInternalFormat());
ColorParams().GLInternalFormat());
if (!image_id_) {
gpu_memory_buffer_ = nullptr;
return;
Expand Down Expand Up @@ -451,23 +449,23 @@ void CanvasResourceGpuMemoryBuffer::WillPaint() {
texture_info.fTarget = TextureTarget();
texture_info.fID = texture_id_;
texture_info.fFormat =
color_params_.GLInternalFormat(); // unsized format
ColorParams().GLInternalFormat(); // unsized format
GrBackendTexture backend_texture(Size().Width(), Size().Height(),
GrMipMapped::kNo, texture_info);
constexpr int sample_count = 0;
surface_ = SkSurface::MakeFromBackendTexture(
GetGrContext(), backend_texture, kTopLeft_GrSurfaceOrigin,
sample_count, color_params_.GetSkColorType(),
color_params_.GetSkColorSpace(), nullptr /*surface props*/);
sample_count, ColorParams().GetSkColorType(),
ColorParams().GetSkColorSpace(), nullptr /*surface props*/);
}
} else {
gpu_memory_buffer_->Map();
void* buffer_base_address = gpu_memory_buffer_->memory(0);
if (!surface_ || buffer_base_address != buffer_base_address_) {
buffer_base_address_ = buffer_base_address;
SkImageInfo image_info = SkImageInfo::Make(
Size().Width(), Size().Height(), color_params_.GetSkColorType(),
color_params_.GetSkAlphaType(), color_params_.GetSkColorSpace());
Size().Width(), Size().Height(), ColorParams().GetSkColorType(),
ColorParams().GetSkAlphaType(), ColorParams().GetSkColorSpace());
surface_ = SkSurface::MakeRasterDirect(image_info, buffer_base_address_,
gpu_memory_buffer_->stride(0));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ class PLATFORM_EXPORT CanvasResourceGpuMemoryBuffer final
sk_sp<SkSurface> surface_;
GLuint image_id_ = 0;
GLuint texture_id_ = 0;
CanvasColorParams color_params_;
MailboxSyncMode mailbox_sync_mode_ = kVerifiedSyncToken;
bool is_accelerated_;
};
Expand Down

0 comments on commit 25d3c98

Please sign in to comment.