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

Side by Side Diff: cc/resources/resource_provider.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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resources/resource_provider.h" 5 #include "cc/resources/resource_provider.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 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 resource_provider_->GrContext(use_worker_context); 982 resource_provider_->GrContext(use_worker_context);
983 uint32_t flags = 983 uint32_t flags =
984 use_distance_field_text ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0; 984 use_distance_field_text ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
985 // Use unknown pixel geometry to disable LCD text. 985 // Use unknown pixel geometry to disable LCD text.
986 SkSurfaceProps surface_props(flags, kUnknown_SkPixelGeometry); 986 SkSurfaceProps surface_props(flags, kUnknown_SkPixelGeometry);
987 if (can_use_lcd_text) { 987 if (can_use_lcd_text) {
988 // LegacyFontHost will get LCD text and skia figures out what type to use. 988 // LegacyFontHost will get LCD text and skia figures out what type to use.
989 surface_props = 989 surface_props =
990 SkSurfaceProps(flags, SkSurfaceProps::kLegacyFontHost_InitType); 990 SkSurfaceProps(flags, SkSurfaceProps::kLegacyFontHost_InitType);
991 } 991 }
992 sk_surface_ = skia::AdoptRef( 992 gr_surface_ =
bsalomon 2016/02/09 14:55:56 Why this change? Is there something missing from t
Kimmo Kinnunen 2016/02/09 18:13:44 To get a GrSurface reference. Maybe I'm missing an
bsalomon 2016/02/09 18:22:12 Oh, of course.
993 SkSurface::NewWrappedRenderTarget(gr_context, desc, &surface_props)); 993 skia::AdoptRef(gr_context->textureProvider()->wrapBackendTexture(
994 desc, kBorrow_GrWrapOwnership));
995 if (gr_surface_)
996 sk_surface_ = skia::AdoptRef(SkSurface::NewRenderTargetDirect(
997 gr_surface_->asRenderTarget(), &surface_props));
994 } 998 }
995 999
996 void ResourceProvider::ScopedWriteLockGr::ReleaseSkSurface() { 1000 void ResourceProvider::ScopedWriteLockGr::ReleaseSkSurface() {
1001 DCHECK(gr_surface_);
1002 gr_surface_->prepareForExternalIO();
Kimmo Kinnunen 2016/02/09 18:13:44 For this call, we need GrSurface.
Kimmo Kinnunen 2016/02/09 18:17:27 Or are you hinting it'd be better just call sk_sur
bsalomon 2016/02/09 18:22:12 I think that'd be preferable. I had been thinking
1003 gr_surface_.clear();
997 sk_surface_.clear(); 1004 sk_surface_.clear();
998 } 1005 }
999 1006
1000 ResourceProvider::SynchronousFence::SynchronousFence( 1007 ResourceProvider::SynchronousFence::SynchronousFence(
1001 gpu::gles2::GLES2Interface* gl) 1008 gpu::gles2::GLES2Interface* gl)
1002 : gl_(gl), has_synchronized_(true) { 1009 : gl_(gl), has_synchronized_(true) {
1003 } 1010 }
1004 1011
1005 ResourceProvider::SynchronousFence::~SynchronousFence() { 1012 ResourceProvider::SynchronousFence::~SynchronousFence() {
1006 } 1013 }
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 1787
1781 const int kImportance = 2; 1788 const int kImportance = 2;
1782 pmd->CreateSharedGlobalAllocatorDump(guid); 1789 pmd->CreateSharedGlobalAllocatorDump(guid);
1783 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 1790 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
1784 } 1791 }
1785 1792
1786 return true; 1793 return true;
1787 } 1794 }
1788 1795
1789 } // namespace cc 1796 } // namespace cc
OLDNEW
« cc/raster/gpu_rasterizer.cc ('K') | « cc/resources/resource_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698