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

Side by Side Diff: tests/SerializationTest.cpp

Issue 2132113002: SkLS accepts nullptr for pointer args, handles alpha accurately, has new GM (Closed) Base URL: https://skia.googlesource.com/skia@dvonbeck-diffuse-api-change
Patch Set: Fixed more windows warnings Created 4 years, 5 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 | « src/gpu/GrFragmentProcessor.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Resources.h" 8 #include "Resources.h"
9 #include "SkAnnotationKeys.h" 9 #include "SkAnnotationKeys.h"
10 #include "SkBitmapProcShader.h" 10 #include "SkBitmapProcShader.h"
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 SkBitmap normals; 580 SkBitmap normals;
581 normals.allocN32Pixels(kTexSize, kTexSize); 581 normals.allocN32Pixels(kTexSize, kTexSize);
582 582
583 sk_tool_utils::create_frustum_normal_map(&normals, SkIRect::MakeWH(kTexS ize, kTexSize)); 583 sk_tool_utils::create_frustum_normal_map(&normals, SkIRect::MakeWH(kTexS ize, kTexSize));
584 sk_sp<SkShader> normalMap = SkMakeBitmapShader(normals, SkShader::kClamp _TileMode, 584 sk_sp<SkShader> normalMap = SkMakeBitmapShader(normals, SkShader::kClamp _TileMode,
585 SkShader::kClamp_TileMode , &matrix, nullptr); 585 SkShader::kClamp_TileMode , &matrix, nullptr);
586 sk_sp<SkNormalSource> normalSource = SkNormalSource::MakeFromNormalMap(s td::move(normalMap), 586 sk_sp<SkNormalSource> normalSource = SkNormalSource::MakeFromNormalMap(s td::move(normalMap),
587 c tm); 587 c tm);
588 sk_sp<SkShader> diffuseShader = SkMakeBitmapShader(diffuse, SkShader::kC lamp_TileMode, 588 sk_sp<SkShader> diffuseShader = SkMakeBitmapShader(diffuse, SkShader::kC lamp_TileMode,
589 SkShader::kClamp_TileMode, &matrix, nullptr); 589 SkShader::kClamp_TileMode, &matrix, nullptr);
590 sk_sp<SkShader> lightingShader = SkLightingShader::Make(std::move(diffus eShader), 590
591 std::move(normal Source), 591 sk_sp<SkShader> lightingShader = SkLightingShader::Make(diffuseShader,
592 normalSource,
592 fLights); 593 fLights);
594 SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get() , true, reporter));
593 595
596 lightingShader = SkLightingShader::Make(std::move(diffuseShader),
597 nullptr,
598 fLights);
594 SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get() , true, reporter)); 599 SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get() , true, reporter));
595 // TODO test equality?
596 600
601 lightingShader = SkLightingShader::Make(nullptr,
602 std::move(normalSource),
603 fLights);
604 SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get() , true, reporter));
605
606 lightingShader = SkLightingShader::Make(nullptr,
607 nullptr,
608 fLights);
609 SkAutoTUnref<SkShader>(TestFlattenableSerialization(lightingShader.get() , true, reporter));
597 } 610 }
598 } 611 }
599 612
600 //////////////////////////////////////////////////////////////////////////////// /////////////////// 613 //////////////////////////////////////////////////////////////////////////////// ///////////////////
601 #include "SkAnnotation.h" 614 #include "SkAnnotation.h"
602 615
603 static sk_sp<SkPicture> copy_picture_via_serialization(SkPicture* src) { 616 static sk_sp<SkPicture> copy_picture_via_serialization(SkPicture* src) {
604 SkDynamicMemoryWStream wstream; 617 SkDynamicMemoryWStream wstream;
605 src->serialize(&wstream); 618 src->serialize(&wstream);
606 SkAutoTDelete<SkStreamAsset> rstream(wstream.detachAsStream()); 619 SkAutoTDelete<SkStreamAsset> rstream(wstream.detachAsStream());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), d1 }, 683 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), d1 },
671 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 }, 684 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 },
672 }; 685 };
673 686
674 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture()); 687 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture());
675 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get())); 688 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get()));
676 689
677 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs)); 690 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs));
678 canvas.drawPicture(pict1); 691 canvas.drawPicture(pict1);
679 } 692 }
OLDNEW
« no previous file with comments | « src/gpu/GrFragmentProcessor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698