Commit Graph

15 Commits

Author SHA1 Message Date
Chris Dalton
b246b9407f Fix croppedrects GM
The stroke-to-rect test was accidentally doing both non-aa draws and
non-filtered texture sampling on exact half pixel boundaries. So
sometimes the CPU and GPU rounded in different directions. This CL
updates the draws and sampling to fall on integer boundaries.

Bug: skia:5522
Change-Id: If968bcbb327106eba8919e4abf3a7211c5326daf
Reviewed-on: https://skia-review.googlesource.com/18960
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2017-06-07 16:41:37 +00:00
Mike Reed
0acd7954a9 add helper makeShader for the common Clamp case
Bug: skia:
Change-Id: I22cac56f35fed16daede0cf1b3e34dfa6f5ae3ea
Reviewed-on: https://skia-review.googlesource.com/14625
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-04-28 15:36:14 +00:00
Robert Phillips
ac6b1fa2c8 Remove budgeted parameter from SkSurface::makeImageSnapshot (take 2)
This unused feature complicates MDB.

Chrome compiles locally for me with this CL.
frameworks/base/libs/hwui compiles locally for me with this CL.

Change-Id: Id3ad64dac72eace52855896df0d7ce3679f15884
Reviewed-on: https://skia-review.googlesource.com/9882
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-03-20 13:50:35 +00:00
Yuqian Li
06ee8e8a3e Revert "Revert "Revert "Remove budgeted parameter from SkSurface::makeImageSnapshot"""
This reverts commit 31249bb2df.

Reason for revert: Android build is still broken as shown below.

out/target/product/bullhead/obj/NATIVE_TESTS/hwui_unit_tests_intermediates/tests/unit/SkiaPipelineTests.o frameworks/base/libs/hwui/tests/unit/SkiaPipelineTests.cpp"
frameworks/base/libs/hwui/tests/unit/SkiaPipelineTests.cpp:211:51: error: non-virtual member function marked 'override' hides virtual member function
    sk_sp<SkImage> onNewImageSnapshot(SkBudgeted) override {
                                                  ^
external/skia/src/image/SkSurface_Base.h:46:28: note: hidden overloaded virtual function 'SkSurface_Base::onNewImageSnapshot' declared here: different number of parameters (0 vs 1)
    virtual sk_sp<SkImage> onNewImageSnapshot() = 0;
                           ^
frameworks/base/libs/hwui/tests/unit/SkiaPipelineTests.cpp:281:84: error: no viable conversion from 'sk_sp<DeferLayer<DeferTestCanvas>>' to 'sk_sp<SkSurface>'
    pipeline->renderFrame(layerUpdateQueue, dirty, nodes, true, contentDrawBounds, surface);
                                                                                   ^~~~~~~
external/skia/include/core/SkRefCnt.h:253:15: note: candidate constructor not viable: no known conversion from 'sk_sp<DeferLayer<DeferTestCanvas> >' to 'std::nullptr_t' (aka 'nullptr_t') for 1st argument
    constexpr sk_sp(std::nullptr_t) : fPtr(nullptr) {}
              ^
external/skia/include/core/SkRefCnt.h:259:5: note: candidate constructor not viable: no known conversion from 'sk_sp<DeferLayer<DeferTestCanvas> >' to 'const sk_sp<SkSurface> &' for 1st argument
    sk_sp(const sk_sp<T>& that) : fPtr(SkSafeRef(that.get())) {}
    ^
external/skia/include/core/SkRefCnt.h:268:5: note: candidate constructor not viable: no known conversion from 'sk_sp<DeferLayer<DeferTestCanvas> >' to 'sk_sp<SkSurface> &&' for 1st argument
    sk_sp(sk_sp<T>&& that) : fPtr(that.release()) {}
    ^
external/skia/include/gpu/../private/SkTLogic.h:27:82: note: candidate template ignored: disabled by 'enable_if' [with U = (anonymous namespace)::DeferLayer<DeferTestCanvas>]
template <bool B, typename T = void> using enable_if_t = typename std::enable_if<B, T>::type;
                                                                                 ^
external/skia/include/gpu/../private/SkTLogic.h:27:82: note: candidate template ignored: disabled by 'enable_if' [with U = (anonymous namespace)::DeferLayer<DeferTestCanvas>]
external/skia/include/core/SkRefCnt.h:327:5: note: candidate function
    operator unspecified_bool_type() const { return this->get() ? &sk_sp::fPtr : nullptr; }
    ^
frameworks/base/libs/hwui/pipeline/skia/SkiaPipeline.h:50:30: note: passing argument to parameter 'surface' here
            sk_sp<SkSurface> surface);
                             ^
frameworks/base/libs/hwui/tests/unit/SkiaPipelineTests.cpp:312:58: error: no viable conversion from 'sk_sp<DeferLayer<ClippedTestCanvas>>' to 'sk_sp<SkSurface>'
            SkRect::MakeWH(CANVAS_WIDTH, CANVAS_HEIGHT), surface);
                                                         ^~~~~~~
external/skia/include/core/SkRefCnt.h:253:15: note: candidate constructor not viable: no known conversion from 'sk_sp<DeferLayer<ClippedTestCanvas> >' to 'std::nullptr_t' (aka 'nullptr_t') for 1st argument
    constexpr sk_sp(std::nullptr_t) : fPtr(nullptr) {}
              ^
external/skia/include/core/SkRefCnt.h:259:5: note: candidate constructor not viable: no known conversion from 'sk_sp<DeferLayer<ClippedTestCanvas> >' to 'const sk_sp<SkSurface> &' for 1st argument
    sk_sp(const sk_sp<T>& that) : fPtr(SkSafeRef(that.get())) {}
    ^
external/skia/include/core/SkRefCnt.h:268:5: note: candidate constructor not viable: no known conversion from 'sk_sp<DeferLayer<ClippedTestCanvas> >' to 'sk_sp<SkSurface> &&' for 1st argument
    sk_sp(sk_sp<T>&& that) : fPtr(that.release()) {}
    ^
external/skia/include/gpu/../private/SkTLogic.h:27:82: note: candidate template ignored: disabled by 'enable_if' [with U = (anonymous namespace)::DeferLayer<ClippedTestCanvas>]
template <bool B, typename T = void> using enable_if_t = typename std::enable_if<B, T>::type;
                                                                                 ^
external/skia/include/gpu/../private/SkTLogic.h:27:82: note: candidate template ignored: disabled by 'enable_if' [with U = (anonymous namespace)::DeferLayer<ClippedTestCanvas>]
external/skia/include/core/SkRefCnt.h:327:5: note: candidate function
    operator unspecified_bool_type() const { return this->get() ? &sk_sp::fPtr : nullptr; }
    ^
frameworks/base/libs/hwui/pipeline/skia/SkiaPipeline.h:50:30: note: passing argument to parameter 'surface' here
            sk_sp<SkSurface> surface);
                             ^
frameworks/base/libs/hwui/tests/unit/SkiaPipelineTests.cpp:343:58: error: no viable conversion from 'sk_sp<DeferLayer<ClipReplaceTestCanvas>>' to 'sk_sp<SkSurface>'
            SkRect::MakeWH(CANVAS_WIDTH, CANVAS_HEIGHT), surface);
                                                         ^~~~~~~
external/skia/include/core/SkRefCnt.h:253:15: note: candidate constructor not viable: no known conversion from 'sk_sp<DeferLayer<ClipReplaceTestCanvas> >' to 'std::nullptr_t' (aka 'nullptr_t') for 1st argument
    constexpr sk_sp(std::nullptr_t) : fPtr(nullptr) {}
              ^
external/skia/include/core/SkRefCnt.h:259:5: note: candidate constructor not viable: no known conversion from 'sk_sp<DeferLayer<ClipReplaceTestCanvas> >' to 'const sk_sp<SkSurface> &' for 1st argument
    sk_sp(const sk_sp<T>& that) : fPtr(SkSafeRef(that.get())) {}
    ^
external/skia/include/core/SkRefCnt.h:268:5: note: candidate constructor not viable: no known conversion from 'sk_sp<DeferLayer<ClipReplaceTestCanvas> >' to 'sk_sp<SkSurface> &&' for 1st argument
    sk_sp(sk_sp<T>&& that) : fPtr(that.release()) {}
    ^
external/skia/include/gpu/../private/SkTLogic.h:27:82: note: candidate template ignored: disabled by 'enable_if' [with U = (anonymous namespace)::DeferLayer<ClipReplaceTestCanvas>]
template <bool B, typename T = void> using enable_if_t = typename std::enable_if<B, T>::type;
                                                                                 ^
external/skia/include/gpu/../private/SkTLogic.h:27:82: note: candidate template ignored: disabled by 'enable_if' [with U = (anonymous namespace)::DeferLayer<ClipReplaceTestCanvas>]
external/skia/include/core/SkRefCnt.h:327:5: note: candidate function
    operator unspecified_bool_type() const { return this->get() ? &sk_sp::fPtr : nullptr; }
    ^
frameworks/base/libs/hwui/pipeline/skia/SkiaPipeline.h:50:30: note: passing argument to parameter 'surface' here
            sk_sp<SkSurface> surface);
                             ^
frameworks/base/libs/hwui/tests/unit/SkiaPipelineTests.cpp:214:42: error: cannot initialize object parameter of type 'SkSurface' with an expression of type '(anonymous namespace)::DeferLayer<DeferTestCanvas>'
    T* canvas() { return static_cast<T*>(getCanvas()); }
                                         ^~~~~~~~~
frameworks/base/libs/hwui/tests/unit/SkiaPipelineTests.cpp:282:27: note: in instantiation of member function '(anonymous namespace)::DeferLayer<DeferTestCanvas>::canvas' requested here
    EXPECT_EQ(4, surface->canvas()->mDrawCounter);
                          ^
frameworks/base/libs/hwui/tests/unit/SkiaPipelineTests.cpp:214:42: error: cannot initialize object parameter of type 'SkSurface' with an expression of type '(anonymous namespace)::DeferLayer<ClippedTestCanvas>'
    T* canvas() { return static_cast<T*>(getCanvas()); }
                                         ^~~~~~~~~
frameworks/base/libs/hwui/tests/unit/SkiaPipelineTests.cpp:313:27: note: in instantiation of member function '(anonymous namespace)::DeferLayer<ClippedTestCanvas>::canvas' requested here
    EXPECT_EQ(1, surface->canvas()->mDrawCounter);
                          ^
frameworks/base/libs/hwui/tests/unit/SkiaPipelineTests.cpp:214:42: error: cannot initialize object parameter of type 'SkSurface' with an expression of type '(anonymous namespace)::DeferLayer<ClipReplaceTestCanvas>'
    T* canvas() { return static_cast<T*>(getCanvas()); }
                                         ^~~~~~~~~
frameworks/base/libs/hwui/tests/unit/SkiaPipelineTests.cpp:344:27: note: in instantiation of member function '(anonymous namespace)::DeferLayer<ClipReplaceTestCanvas>::canvas' requested here
    EXPECT_EQ(1, surface->canvas()->mDrawCounter);

Original change's description:
> Revert "Revert "Remove budgeted parameter from SkSurface::makeImageSnapshot""
> 
> This reverts commit 9e9188f84b.
> 
> Reason for revert: Android-side fix has landed
> 
> Original change's description:
> > Revert "Remove budgeted parameter from SkSurface::makeImageSnapshot"
> > 
> > This reverts commit b64bcbdc3a.
> > 
> > Reason for revert: 
> > 
> > Android build failed as shown below.
> > 
> > frameworks/base/libs/hwui/VkLayer.cpp:32:41: error: too many arguments to function call, expected 0, have 1
> >     mImage = surface->makeImageSnapshot(SkBudgeted::kNo);
> > 
> > Original change's description:
> > > Remove budgeted parameter from SkSurface::makeImageSnapshot
> > > 
> > > This unused feature complicates MDB.
> > > 
> > > Chrome compiles locally for me with this CL.
> > > 
> > > Change-Id: I611e464885fb984030eace43ead42cf39d0e7f72
> > > Reviewed-on: https://skia-review.googlesource.com/9734
> > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > Commit-Queue: Robert Phillips <robertphillips@google.com>
> > > 
> > 
> > TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > 
> > Change-Id: Iae6e313c15b2352bd0d4fc7b5629de0a51ac398e
> > Reviewed-on: https://skia-review.googlesource.com/9788
> > Reviewed-by: Yuqian Li <liyuqian@google.com>
> > Commit-Queue: Yuqian Li <liyuqian@google.com>
> > 
> 
> TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org,liyuqian@google.com
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Change-Id: If07d1b5db6e6c618d37445a0cf127780ed243a92
> Reviewed-on: https://skia-review.googlesource.com/9843
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> 

TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org,liyuqian@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I674b0a9d4130e00164d2e0344a92c373cf70f4fd
Reviewed-on: https://skia-review.googlesource.com/9873
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
2017-03-17 20:50:19 +00:00
Robert Phillips
31249bb2df Revert "Revert "Remove budgeted parameter from SkSurface::makeImageSnapshot""
This reverts commit 9e9188f84b.

Reason for revert: Android-side fix has landed

Original change's description:
> Revert "Remove budgeted parameter from SkSurface::makeImageSnapshot"
> 
> This reverts commit b64bcbdc3a.
> 
> Reason for revert: 
> 
> Android build failed as shown below.
> 
> frameworks/base/libs/hwui/VkLayer.cpp:32:41: error: too many arguments to function call, expected 0, have 1
>     mImage = surface->makeImageSnapshot(SkBudgeted::kNo);
> 
> Original change's description:
> > Remove budgeted parameter from SkSurface::makeImageSnapshot
> > 
> > This unused feature complicates MDB.
> > 
> > Chrome compiles locally for me with this CL.
> > 
> > Change-Id: I611e464885fb984030eace43ead42cf39d0e7f72
> > Reviewed-on: https://skia-review.googlesource.com/9734
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Robert Phillips <robertphillips@google.com>
> > 
> 
> TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> 
> Change-Id: Iae6e313c15b2352bd0d4fc7b5629de0a51ac398e
> Reviewed-on: https://skia-review.googlesource.com/9788
> Reviewed-by: Yuqian Li <liyuqian@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>
> 

TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org,liyuqian@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: If07d1b5db6e6c618d37445a0cf127780ed243a92
Reviewed-on: https://skia-review.googlesource.com/9843
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-03-17 17:44:01 +00:00
Yuqian Li
9e9188f84b Revert "Remove budgeted parameter from SkSurface::makeImageSnapshot"
This reverts commit b64bcbdc3a.

Reason for revert: 

Android build failed as shown below.

frameworks/base/libs/hwui/VkLayer.cpp:32:41: error: too many arguments to function call, expected 0, have 1
    mImage = surface->makeImageSnapshot(SkBudgeted::kNo);

Original change's description:
> Remove budgeted parameter from SkSurface::makeImageSnapshot
> 
> This unused feature complicates MDB.
> 
> Chrome compiles locally for me with this CL.
> 
> Change-Id: I611e464885fb984030eace43ead42cf39d0e7f72
> Reviewed-on: https://skia-review.googlesource.com/9734
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> 

TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Iae6e313c15b2352bd0d4fc7b5629de0a51ac398e
Reviewed-on: https://skia-review.googlesource.com/9788
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
2017-03-16 15:05:04 +00:00
Robert Phillips
b64bcbdc3a Remove budgeted parameter from SkSurface::makeImageSnapshot
This unused feature complicates MDB.

Chrome compiles locally for me with this CL.

Change-Id: I611e464885fb984030eace43ead42cf39d0e7f72
Reviewed-on: https://skia-review.googlesource.com/9734
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-03-16 13:36:06 +00:00
Mike Reed
85ff84821d remove unused ForceUnique option from makeImageSnapshot
BUG=skia:

Change-Id: I2555ceb86b597f7bb34c8fc48b3e07eb7115ea82
Reviewed-on: https://skia-review.googlesource.com/6481
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2016-12-29 16:01:42 +00:00
Brian Salomon
09d994ecb3 Misc batch->op cleanup Part 1 of 2
Change-Id: I80f951976558a284e55386e0a368f08bd835d8ca
Reviewed-on: https://skia-review.googlesource.com/6359
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2016-12-21 16:45:40 +00:00
Brian Osman
1105224f97 Rename GrDrawContext to GrRenderTargetContext
This is in preparation for GrTextureContext and GrSurfaceContext

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4030

Change-Id: Ie58c93052e68f3f1f5fe8d15d63760de274a6fbd
Reviewed-on: https://skia-review.googlesource.com/4030
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2016-10-27 19:14:09 +00:00
csmartdalton
97f6cd5d0f Pre-crop filled rects to avoid scissor
Updates GrDrawContext to crop filled rects to the clip bounds before
creating batches for them. Also adds clipping logic to ignore scissor
when the draw falls completely inside. These two changes combined
reduce API traffic and improve batching.

In the future this can and should be improved by switching to floating
point clip boundaries, thus allowing us to throw out non pixel aligned
rectangle clips as well.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2132073002

Committed: https://skia.googlesource.com/skia/+/7969838702135b9f127bd738728da61bc49b050a
Committed: https://skia.googlesource.com/skia/+/86de59f4a99b5f54be0483c60ff0335be55b2bdf
Review-Url: https://codereview.chromium.org/2132073002
2016-07-13 13:37:08 -07:00
msarett
ba3880fa6d Revert of Pre-crop filled rects to avoid scissor (patchset #6 id:100001 of https://codereview.chromium.org/2132073002/ )
Reason for revert:
I think this is still causing a test failure on Chrome windows bots.

https://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/243928/steps/cc_unittests%20%28with%20patch%29%20on%20Windows-7-SP1/logs/stdio

Original issue's description:
> Pre-crop filled rects to avoid scissor
>
> Updates GrDrawContext to crop filled rects to the clip bounds before
> creating batches for them. Also adds clipping logic to ignore scissor
> when the draw falls completely inside. These two changes combined
> reduce API traffic and improve batching.
>
> In the future this can and should be improved by switching to floating
> point clip boundaries, thus allowing us to throw out non pixel aligned
> rectangle clips as well.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2132073002
>
> Committed: https://skia.googlesource.com/skia/+/7969838702135b9f127bd738728da61bc49b050a
> Committed: https://skia.googlesource.com/skia/+/86de59f4a99b5f54be0483c60ff0335be55b2bdf

TBR=bsalomon@google.com,robertphillips@google.com,csmartdalton@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review-Url: https://codereview.chromium.org/2140253004
2016-07-12 18:48:21 -07:00
csmartdalton
86de59f4a9 Pre-crop filled rects to avoid scissor
Updates GrDrawContext to crop filled rects to the clip bounds before
creating batches for them. Also adds clipping logic to ignore scissor
when the draw falls completely inside. These two changes combined
reduce API traffic and improve batching.

In the future this can and should be improved by switching to floating
point clip boundaries, thus allowing us to throw out non pixel aligned
rectangle clips as well.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2132073002

Committed: https://skia.googlesource.com/skia/+/7969838702135b9f127bd738728da61bc49b050a
Review-Url: https://codereview.chromium.org/2132073002
2016-07-12 14:45:23 -07:00
msarett
aeadcdfbf2 Revert of Pre-crop filled rects to avoid scissor (patchset #6 id:100001 of https://codereview.chromium.org/2132073002/ )
Reason for revert:
I believe that this is breaking the roll.

https://codereview.chromium.org/2141923002

https://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/258434/steps/cc_unittests%20%28with%20patch%29%20on%20Mac-10.9/logs/stdio

Original issue's description:
> Pre-crop filled rects to avoid scissor
>
> Updates GrDrawContext to crop filled rects to the clip bounds before
> creating batches for them. Also adds clipping logic to ignore scissor
> when the draw falls completely inside. These two changes combined
> reduce API traffic and improve batching.
>
> In the future this can and should be improved by switching to floating
> point clip boundaries, thus allowing us to throw out non pixel aligned
> rectangle clips as well.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2132073002
>
> Committed: https://skia.googlesource.com/skia/+/7969838702135b9f127bd738728da61bc49b050a

TBR=bsalomon@google.com,robertphillips@google.com,csmartdalton@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review-Url: https://codereview.chromium.org/2145573002
2016-07-12 05:40:39 -07:00
csmartdalton
7969838702 Pre-crop filled rects to avoid scissor
Updates GrDrawContext to crop filled rects to the clip bounds before
creating batches for them. Also adds clipping logic to ignore scissor
when the draw falls completely inside. These two changes combined
reduce API traffic and improve batching.

In the future this can and should be improved by switching to floating
point clip boundaries, thus allowing us to throw out non pixel aligned
rectangle clips as well.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2132073002

Review-Url: https://codereview.chromium.org/2132073002
2016-07-11 14:34:12 -07:00