Author: shaovoon
-
C++: Faster to Retrieve Data By Ref Parameter or Returning a Ref?
In C++, there are two options to retrieve data from a object: either passing a reference parameter to be filled up or returning a reference. The former is making a copy of data (which may be what the developer wants) while the latter is returning a memory address of the data. The example code is […]
-
Direct2D Tutorial Part 4: Gradient Brush
Table of Contents Introduction Linear Gradient Rainbow Linear Gradient Rainbow Linear Gradient Text Radial Gradient Radial Gradient Text Demo Code History Articles in the Series The example code is hosted at Github. Introduction In this article, we’ll look at how to draw with linear and radial gradient colors in Direct2D. The prerequisite of the article […]
-
Direct2D Tutorial Part 3: Affine Transforms
Table of Content Introduction Text Format Translation Skew Rotation Scale The example code is hosted at Github. Introduction In this article, we’ll look at how to do affine transform using matrices in Direct2D. The transformation has to be set up before any drawing that is to be transformed. The prerequisite of the article […]
-
Direct2D Tutorial Part 2: Basic Shapes
Table of Content Introduction Stroke Style Solid Color Brush Line Rectangle Rounded Rectangle Triangle Circle The example code is hosted at Github. Introduction In this article, we’ll look at how to draw lines and basic shapes in Direct2D. The prerequisite of the article is the knowledge to set up the RenderTarget. If you haven’t got […]
-
The Power of C++ in Hands of a Junior Developer
This 17 seconds anime shows the unbridled power of C++ in the hands of a junior developer. As C++ creator, Bjarne Stroustrup, once said: C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.
-
Optimizations That You Have to Wring From WebAssembly
Introduction First of all, I want to put up a disclaimer: I am not a WebAsssembly expert. All the 5 tips mentioned in this article are gained from my C++ OpenGL slideshow application. I have to admit I have no working knowledge on Blazor, an implementation of Webassembly for C# and .NET. And I am […]
-
Bug Reports: Memory Leak in VC++ PPL and ASAN support in MFC
Today, I just filed 2 bug reports on Visual C++: Memory Leaks in VC++ PPL’s parallel_for_each() reported by Deleaker and MFC support in Address Sanitizer. The latter is having linkage issue of duplicate symbols of new/delete operators that exists in both MFC and Clang ASAN. I need your help to upvote these 2 bug reports […]
-
Direct2D Tutorial Part 1: RenderTarget
Introduction Direct2D is introduced to phase out the dated GDI+ in 2009 and is supported on Windows 7 or newer. This is the first in an introductory Direct2D tutorial series. In this tutorial, we are going to take a look at various different RenderTarget. Think RenderTarget as a canvas to draw on. We focus on […]
-
C/C++: Allocate Variable-size Arrays on the Stack
C language provides the alloca function to allocate arbitrary size array on the stack. After the function returns or the scope ends, the stack memory is automatically reclaimed back(popped back) without the developer having to deallocate it explicitly and thereafter is unsafe to access it again from another function. The below code shows allocating fixed […]
-
Address Sanitizer in Visual C++
In this blog, I’ll demonstrate on how to utilize Address Sanitizer (ASan) in Visual C++ to check for memory problems. MSVC team ported the Clang ASan to the Windows platform in 2019 and since it is still at the experimental stage, be sure to expect kinks to be ironed out. Before using Address Sanitizer in […]