Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(628)

Side by Side Diff: cc/output/gl_renderer.cc

Issue 1653983002: cc: Avoid extra flush calls to Skia GrContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: eh Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/raster/gpu_rasterizer.cc » ('j') | cc/raster/gpu_rasterizer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 SkMatrix local_matrix; 648 SkMatrix local_matrix;
649 local_matrix.setScale(scale.x(), scale.y()); 649 local_matrix.setScale(scale.x(), scale.y());
650 skia::RefPtr<SkImageFilter> filter_with_local_scale = 650 skia::RefPtr<SkImageFilter> filter_with_local_scale =
651 skia::AdoptRef(filter->newWithLocalMatrix(local_matrix)); 651 skia::AdoptRef(filter->newWithLocalMatrix(local_matrix));
652 652
653 SkPaint paint; 653 SkPaint paint;
654 paint.setImageFilter(filter_with_local_scale.get()); 654 paint.setImageFilter(filter_with_local_scale.get());
655 surface->getCanvas()->translate(-dst_rect.x(), -dst_rect.y()); 655 surface->getCanvas()->translate(-dst_rect.x(), -dst_rect.y());
656 surface->getCanvas()->drawImage(srcImage.get(), src_rect.x(), src_rect.y(), 656 surface->getCanvas()->drawImage(srcImage.get(), src_rect.x(), src_rect.y(),
657 &paint); 657 &paint);
658 658 // Flush the drawing before source texture read lock goes out of scope.
659 // Skia API does not guarantee that when the SkImage goes out of scope,
660 // its externally referenced resources would force the rendering to be
661 // flushed.
662 surface->getCanvas()->flush();
659 skia::RefPtr<SkImage> image = skia::AdoptRef(surface->newImageSnapshot()); 663 skia::RefPtr<SkImage> image = skia::AdoptRef(surface->newImageSnapshot());
660 if (!image || !image->isTextureBacked()) { 664 if (!image || !image->isTextureBacked()) {
661 return skia::RefPtr<SkImage>(); 665 return skia::RefPtr<SkImage>();
662 } 666 }
663 667
664 CHECK(image->isTextureBacked()); 668 CHECK(image->isTextureBacked());
665 return image; 669 return image;
666 } 670 }
667 671
668 bool GLRenderer::CanApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode) { 672 bool GLRenderer::CanApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode) {
(...skipping 2952 matching lines...) Expand 10 before | Expand all | Expand 10 after
3621 texture_id = pending_overlay_resources_.back()->texture_id(); 3625 texture_id = pending_overlay_resources_.back()->texture_id();
3622 } 3626 }
3623 3627
3624 context_support_->ScheduleOverlayPlane( 3628 context_support_->ScheduleOverlayPlane(
3625 overlay.plane_z_order, overlay.transform, texture_id, 3629 overlay.plane_z_order, overlay.transform, texture_id,
3626 ToNearestRect(overlay.display_rect), overlay.uv_rect); 3630 ToNearestRect(overlay.display_rect), overlay.uv_rect);
3627 } 3631 }
3628 } 3632 }
3629 3633
3630 } // namespace cc 3634 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/raster/gpu_rasterizer.cc » ('j') | cc/raster/gpu_rasterizer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698